/** * Schedule something on our timer. * * @since 0.9.23 */ public void schedule(SimpleTimer.TimedEvent event, long msToWait) { _timer.addEvent(event, msToWait); }
public IPThrottler(int max, long time) { _max = max; _counter = new ObjectCounter<Integer>(); SimpleTimer2.getInstance().addPeriodicEvent(new Cleaner(), time); }
/** * @param args the command line arguments, these are not used yet */ public static void main(String[] args) { // THINK THINK THINK THINK THINK THINK SimpleTimer2 Y2 = SimpleTimer2.getInstance(); BOB.main(args); Y2.stop(); } }
/** schedules itself */ public Cleaner() { super(SimpleTimer2.getInstance(), _checkPeriod); }
/** * Schedule periodic event * * The TimedEvent must not do its own rescheduling. * As all Exceptions are caught in run(), these will not prevent * subsequent executions (unlike SimpleTimer, where the TimedEvent does * its own rescheduling). * * For transition from SimpleScheduler. Uncancellable. * New code should use SimpleTimer2.TimedEvent. * * @since 0.9.20 * @param timeoutMs run subsequent iterations of this event every timeoutMs ms, 5000 minimum * @throws IllegalArgumentException if timeoutMs less than 5000 */ public void addPeriodicEvent(final SimpleTimer.TimedEvent event, final long timeoutMs) { addPeriodicEvent(event, timeoutMs, timeoutMs); }
public void run() { stop(); } }
private void initializeSimpleTimer2() { synchronized (_lock20) { if (_simpleTimer2 == null) _simpleTimer2 = new SimpleTimer2(this); _simpleTimer2Initialized = true; } }
public Cleaner() { super(SimpleTimer2.getInstance(), 5 * CLEAN_TIME); }
/** @since 0.7.12 */ private void startTimestamper() { _context.simpleTimer2().addPeriodicEvent(new Timestamper(), TIME_START_DELAY, TIME_REPEAT_DELAY); }
/** * Kill all connections and the timers. * Don't bother sending close packets. * As of 0.9.17, this will close the ServerSocket, killing one thread in accept(). * * CANNOT continue to use the manager or restart. * * @since 0.9.7 */ public void shutdown() { //if (_log.shouldLog(Log.INFO)) // _log.info("ConnMan shutdown", new Exception("I did it")); disconnectAllHard(); _tcbShare.stop(); _timer.stop(); _outboundQueue.close(); _connectionHandler.setActive(false); }
/** * The reseed is complete * * @since 0.9 */ void done() { _inProgress.set(false); _context.simpleTimer2().addEvent(new StatusCleaner(_lastStatus, _lastError), STATUS_CLEAN_TIME); }
FloodThrottler() { this.counter = new ObjectCounter<Hash>(); SimpleTimer2.getInstance().addPeriodicEvent(new Cleaner(), CLEAN_TIME); }
public Explorer(long delay) { super(SimpleTimer2.getInstance(), delay); }
public OutboundCache(RouterContext ctx) { _context = ctx; _context.simpleTimer2().addPeriodicEvent(new OCMOSJCacheCleaner(), CLEAN_INTERVAL, CLEAN_INTERVAL); }
/** * Kill all connections and the timers. * Don't bother sending close packets. * As of 0.9.17, this will close the ServerSocket, killing one thread in accept(). * * CANNOT continue to use the manager or restart. * * @since 0.9.7 */ public void shutdown() { //if (_log.shouldLog(Log.INFO)) // _log.info("ConnMan shutdown", new Exception("I did it")); disconnectAllHard(); _tcbShare.stop(); _timer.stop(); _outboundQueue.close(); _connectionHandler.setActive(false); }
private void startIdleMonitor() { _isReduced = false; boolean reduce = Boolean.parseBoolean(_options.getProperty("i2cp.reduceOnIdle")); boolean close = Boolean.parseBoolean(_options.getProperty("i2cp.closeOnIdle")); if (reduce || close) { updateActivity(); _context.simpleTimer2().addEvent(new SessionIdleTimer(_context, this, reduce, close), SessionIdleTimer.MINIMUM_TIME); } }
LookupThrottler() { this.counter = new ObjectCounter<ReplyTunnel>(); SimpleTimer2.getInstance().addPeriodicEvent(new Cleaner(), CLEAN_TIME); }
/** * Either wait on this object with a timeout, or use non-null Runnables. * Any sent data to be remembered may be stored by setSentObject(). * Reply object may be in getReplyObject(). * @param onReply must be fast, otherwise set to null and wait on this UNUSED * @param onTimeout must be fast, otherwise set to null and wait on this UNUSED */ public ReplyWaiter(MsgID mID, NodeInfo nInfo, Runnable onReply, Runnable onTimeout) { super(SimpleTimer2.getInstance(), DEFAULT_QUERY_TIMEOUT); this.mid = mID; this.sentTo = nInfo; this.onReply = onReply; this.onTimeout = onTimeout; }
RequestThrottler(RouterContext ctx) { this.context = ctx; this.counter = new ObjectCounter<Hash>(); ctx.simpleTimer2().addPeriodicEvent(new Cleaner(), CLEAN_TIME); }
private void startGeoIP() { _context.simpleTimer2().addEvent(new QueueAll(), START_DELAY); }