Changeset b4a50ed


Ignore:
Timestamp:
Aug 3, 2012 5:13:17 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
4a1b839, 85a4e9c, afad77af
Parents:
00f9fea
Message:

replace SimpleScheduler?.getInstance() calls

Files:
26 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/ConnectionAcceptor.java

    r00f9fea rb4a50ed  
    6868          thread.setDaemon(true);
    6969          thread.start();
    70           SimpleScheduler.getInstance().addPeriodicEvent(new Cleaner(), BAD_CLEAN_INTERVAL);
     70          _util.getContext().simpleScheduler().addPeriodicEvent(new Cleaner(), BAD_CLEAN_INTERVAL);
    7171      }
    7272    }
     
    8383    thread.setDaemon(true);
    8484    thread.start();
    85     SimpleScheduler.getInstance().addPeriodicEvent(new Cleaner(), BAD_CLEAN_INTERVAL);
     85    _util.getContext().simpleScheduler().addPeriodicEvent(new Cleaner(), BAD_CLEAN_INTERVAL);
    8686  }
    8787
  • apps/i2psnark/java/src/org/klomp/snark/I2PSnarkUtil.java

    r00f9fea rb4a50ed  
    310310        } catch (I2PException ie) {
    311311            _shitlist.add(dest);
    312             SimpleScheduler.getInstance().addEvent(new Unshitlist(dest), 10*60*1000);
     312            _context.simpleScheduler().addEvent(new Unshitlist(dest), 10*60*1000);
    313313            throw new IOException("Unable to reach the peer " + peer + ": " + ie.getMessage());
    314314        }
  • apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java

    r00f9fea rb4a50ed  
    17111711                // Schedule this even for final shutdown, as there's a chance
    17121712                // that it's just this webapp that is stopping.
    1713                 SimpleScheduler.getInstance().addEvent(new Disconnector(), 60*1000);
     1713                _context.simpleScheduler().addEvent(new Disconnector(), 60*1000);
    17141714                addMessage(_("Closing I2P tunnel after notifying trackers."));
    17151715                if (finalShutdown) {
  • apps/routerconsole/java/src/net/i2p/router/web/PluginUpdateChecker.java

    r00f9fea rb4a50ed  
    124124
    125125    private void scheduleStatusClean(String msg) {
    126         SimpleScheduler.getInstance().addEvent(new Cleaner(msg), 20*60*1000);
     126        _context.simpleScheduler().addEvent(new Cleaner(msg), 20*60*1000);
    127127    }
    128128
  • apps/routerconsole/java/src/net/i2p/router/web/PluginUpdateHandler.java

    r00f9fea rb4a50ed  
    9999
    100100    private void scheduleStatusClean(String msg) {
    101         SimpleScheduler.getInstance().addEvent(new Cleaner(msg), 20*60*1000);
     101        _context.simpleScheduler().addEvent(new Cleaner(msg), 20*60*1000);
    102102    }
    103103
  • apps/streaming/java/src/net/i2p/client/streaming/Connection.java

    r00f9fea rb4a50ed  
    280280        if (_disconnectScheduledOn < 0) {
    281281            _disconnectScheduledOn = _context.clock().now();
    282             SimpleScheduler.getInstance().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
     282            _context.simpleScheduler().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
    283283        }
    284284        long now = _context.clock().now();
     
    535535        if (_disconnectScheduledOn < 0) {
    536536            _disconnectScheduledOn = _context.clock().now();
    537             SimpleScheduler.getInstance().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
     537            _context.simpleScheduler().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
    538538        }
    539539        _resetReceived = true;
     
    579579            if (_disconnectScheduledOn < 0) {
    580580                _disconnectScheduledOn = _context.clock().now();
    581                 SimpleScheduler.getInstance().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
     581                _context.simpleScheduler().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
    582582            }
    583583        }
     
    797797        if (_disconnectScheduledOn < 0) {
    798798            _disconnectScheduledOn = _context.clock().now();
    799             SimpleScheduler.getInstance().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
     799            _context.simpleScheduler().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
    800800        }
    801801    }
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionHandler.java

    r00f9fea rb4a50ed  
    7979        boolean success = _synQueue.offer(packet); // fail immediately if full
    8080        if (success) {
    81             SimpleScheduler.getInstance().addEvent(new TimeoutSyn(packet), _acceptTimeout);
     81            _context.simpleScheduler().addEvent(new TimeoutSyn(packet), _acceptTimeout);
    8282        } else {
    8383            if (_log.shouldLog(Log.WARN))
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionPacketHandler.java

    r00f9fea rb4a50ed  
    185185                if (_log.shouldLog(Log.WARN))
    186186                    _log.warn("congestion.. dup " + packet);
    187                 SimpleScheduler.getInstance().addEvent(new AckDup(con), con.getOptions().getSendAckDelay());
     187                _context.simpleScheduler().addEvent(new AckDup(con), con.getOptions().getSendAckDelay());
    188188                //con.setNextSendTime(_context.clock().now() + con.getOptions().getSendAckDelay());
    189189                //fastAck = true;
  • apps/streaming/java/src/net/i2p/client/streaming/SchedulerImpl.java

    r00f9fea rb4a50ed  
    1818   
    1919    protected void reschedule(long msToWait, Connection con) {
    20         SimpleScheduler.getInstance().addEvent(con.getConnectionEvent(), msToWait);
     20        _context.simpleScheduler().addEvent(con.getConnectionEvent(), msToWait);
    2121    }
    2222
  • core/java/src/net/i2p/client/I2PSessionImpl.java

    r00f9fea rb4a50ed  
    478478     */
    479479    private void startVerifyUsage() {
    480         SimpleScheduler.getInstance().addEvent(new VerifyUsage(), VERIFY_USAGE_TIME);
     480        _context.simpleScheduler().addEvent(new VerifyUsage(), VERIFY_USAGE_TIME);
    481481    }
    482482
     
    502502            }
    503503            toCheck.addAll(_availableMessages.keySet());
    504             SimpleScheduler.getInstance().addEvent(this, VERIFY_USAGE_TIME);
     504            _context.simpleScheduler().addEvent(this, VERIFY_USAGE_TIME);
    505505        }
    506506    }
     
    968968        if (reduce || close) {
    969969            updateActivity();
    970             SimpleScheduler.getInstance().addEvent(new SessionIdleTimer(_context, this, reduce, close), SessionIdleTimer.MINIMUM_TIME);
     970            _context.simpleScheduler().addEvent(new SessionIdleTimer(_context, this, reduce, close), SessionIdleTimer.MINIMUM_TIME);
    971971        }
    972972    }
  • core/java/src/net/i2p/client/SessionIdleTimer.java

    r00f9fea rb4a50ed  
    113113            nextDelay = _minimumTime - (now - lastActivity);
    114114        }
    115         SimpleScheduler.getInstance().addEvent(this, nextDelay);
     115        _context.simpleScheduler().addEvent(this, nextDelay);
    116116    }
    117117}
  • core/java/src/net/i2p/crypto/TransientSessionKeyManager.java

    r00f9fea rb4a50ed  
    182182        context.statManager().createRateStat("crypto.sessionTagsRemaining", "How many tags/sessions are remaining after a cleanup?", "Encryption", new long[] { 10*60*1000, 60*60*1000, 3*60*60*1000 });
    183183         _alive = true;
    184         SimpleScheduler.getInstance().addEvent(new CleanupEvent(), 60*1000);
     184        _context.simpleScheduler().addEvent(new CleanupEvent(), 60*1000);
    185185    }
    186186   
     
    204204            long expireTime = _context.clock().now() - beforeExpire;
    205205            _context.statManager().addRateData("crypto.sessionTagsExpired", expired, expireTime);
    206             SimpleScheduler.getInstance().addEvent(this, 60*1000);
     206            _context.simpleScheduler().addEvent(this, 60*1000);
    207207        }
    208208    }
  • core/java/src/net/i2p/util/SimpleScheduler.java

    r00f9fea rb4a50ed  
    147147     */
    148148    private class RunnableEvent implements Runnable {
    149         protected SimpleTimer.TimedEvent _timedEvent;
     149        protected final SimpleTimer.TimedEvent _timedEvent;
    150150        protected long _scheduled;
    151151
  • history.txt

    r00f9fea rb4a50ed  
     12012-08-03 zzz
     2 * build.xml: Add buildI2PTunnelJar target for Android
     3 * i2psnark: Finish migration to I2P logging to reduce object churn (ticket #673)
     4 * LogManager: Add logger.logBufferSize and logger.dropOnOverflow options (ticket #662)
     5 * JobQueue: Synch fix (ticket #670)
     6 * OutNetMessage: Fix NPE when log level = INFO (ticket #676)
     7 * SimpleScheduler, SimpleTimer2: Replace getInstance() calls
     8 * UDP:
     9   - Catch some cases where UDPPackets were not returned to the cache (ticket #675)
     10   - Fix inverted logging logic (ticket #663)
     11   - Remove check in UDPPacket.getLifetime() (ticket #664)
     12   - RemoteHostID cleanup, cache hashcode
     13   - Remove udp.fetchRemoteSlow stat
     14   - Remove some time stamping in UDPPacket
     15   - Other cleanups - see http://zzz.i2p/topics/1198
     16
    1172012-07-30 zzz
    218 * build.xml: Move more default properties to build.properties
  • router/java/src/net/i2p/router/Router.java

    r00f9fea rb4a50ed  
    432432        startupQueue();
    433433        //_context.jobQueue().addJob(new CoalesceStatsJob(_context));
    434         SimpleScheduler.getInstance().addPeriodicEvent(new CoalesceStatsEvent(_context), COALESCE_TIME);
     434        _context.simpleScheduler().addPeriodicEvent(new CoalesceStatsEvent(_context), COALESCE_TIME);
    435435        _context.jobQueue().addJob(new UpdateRoutingKeyModifierJob(_context));
    436436        warmupCrypto();
     
    539539                r.timeReached();
    540540            else
    541                 SimpleScheduler.getInstance().addEvent(r, 0);
     541                _context.simpleScheduler().addEvent(r, 0);
    542542        } catch (DataFormatException dfe) {
    543543            _log.log(Log.CRIT, "Internal error - unable to sign our own address?!", dfe);
     
    13491349    private void beginMarkingLiveliness() {
    13501350        File f = getPingFile();
    1351         SimpleScheduler.getInstance().addPeriodicEvent(new MarkLiveliness(this, f), 0, LIVELINESS_DELAY - (5*1000));
     1351        _context.simpleScheduler().addPeriodicEvent(new MarkLiveliness(this, f), 0, LIVELINESS_DELAY - (5*1000));
    13521352    }
    13531353   
  • router/java/src/net/i2p/router/RouterThrottleImpl.java

    r00f9fea rb4a50ed  
    4646        _log = context.logManager().getLog(RouterThrottleImpl.class);
    4747        setTunnelStatus();
    48         SimpleScheduler.getInstance().addEvent(new ResetStatus(), REJECT_STARTUP_TIME + 120*1000);
     48        _context.simpleScheduler().addEvent(new ResetStatus(), REJECT_STARTUP_TIME + 120*1000);
    4949        _context.statManager().createRateStat("router.throttleNetworkCause", "How lagged the jobQueue was when an I2NP was throttled", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 });
    5050        //_context.statManager().createRateStat("router.throttleNetDbCause", "How lagged the jobQueue was when a networkDb request was throttled", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 });
  • router/java/src/net/i2p/router/RouterVersion.java

    r00f9fea rb4a50ed  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 1;
     21    public final static long BUILD = 2;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/client/ClientConnectionRunner.java

    r00f9fea rb4a50ed  
    447447                } else {
    448448                    // ours is newer, so wait a few secs and retry
    449                     SimpleScheduler.getInstance().addEvent(new Rerequest(set, expirationTime, onCreateJob, onFailedJob), 3*1000);
     449                    _context.simpleScheduler().addEvent(new Rerequest(set, expirationTime, onCreateJob, onFailedJob), 3*1000);
    450450                }
    451451                // fire onCreated?
  • router/java/src/net/i2p/router/message/OutboundCache.java

    r00f9fea rb4a50ed  
    103103    public OutboundCache(RouterContext ctx) {
    104104        _context = ctx;
    105         SimpleScheduler.getInstance().addPeriodicEvent(new OCMOSJCacheCleaner(), CLEAN_INTERVAL, CLEAN_INTERVAL);
     105        _context.simpleScheduler().addPeriodicEvent(new OCMOSJCacheCleaner(), CLEAN_INTERVAL, CLEAN_INTERVAL);
    106106    }
    107107
  • router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java

    r00f9fea rb4a50ed  
    417417    private void startGeoIP() {
    418418        _geoIP = new GeoIP(_context);
    419         SimpleScheduler.getInstance().addEvent(new QueueAll(), START_DELAY);
     419        _context.simpleScheduler().addEvent(new QueueAll(), START_DELAY);
    420420    }
    421421
     
    435435                _geoIP.add(host);
    436436            }
    437             SimpleScheduler.getInstance().addPeriodicEvent(new Lookup(), 5000, LOOKUP_TIME);
     437            _context.simpleScheduler().addPeriodicEvent(new Lookup(), 5000, LOOKUP_TIME);
    438438        }
    439439    }
     
    557557    /** @since 0.7.12 */
    558558    private void startTimestamper() {
    559         SimpleScheduler.getInstance().addPeriodicEvent(new Timestamper(), TIME_START_DELAY,  TIME_REPEAT_DELAY);
     559        _context.simpleScheduler().addPeriodicEvent(new Timestamper(), TIME_START_DELAY,  TIME_REPEAT_DELAY);
    560560    }
    561561
  • router/java/src/net/i2p/router/transport/TransportImpl.java

    r00f9fea rb4a50ed  
    7575        _unreachableEntries = new HashMap(16);
    7676        _wasUnreachableEntries = new ConcurrentHashSet(16);
    77         SimpleScheduler.getInstance().addPeriodicEvent(new CleanupUnreachable(), 2 * UNREACHABLE_PERIOD, UNREACHABLE_PERIOD / 2);
     77        _context.simpleScheduler().addPeriodicEvent(new CleanupUnreachable(), 2 * UNREACHABLE_PERIOD, UNREACHABLE_PERIOD / 2);
    7878    }
    7979
  • router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java

    r00f9fea rb4a50ed  
    218218                        state = oldState;
    219219                    else
    220                         SimpleScheduler.getInstance().addEvent(new Expire(to, state), 10*1000);
     220                        _context.simpleScheduler().addEvent(new Expire(to, state), 10*1000);
    221221                }
    222222            }
     
    466466                                               new SessionKey(addr.getIntroKey()), addr);
    467467            _outboundStates.put(to, qstate);
    468             SimpleScheduler.getInstance().addEvent(new Expire(to, qstate), 10*1000);
     468            _context.simpleScheduler().addEvent(new Expire(to, qstate), 10*1000);
    469469
    470470            for (int i = 0; i < queued.size(); i++) {
     
    545545        dsm.setMessageId(_context.random().nextLong(I2NPMessage.MAX_ID_VALUE));
    546546        _transport.send(dsm, peer);
    547         SimpleScheduler.getInstance().addEvent(new PublishToNewInbound(peer), 0);
     547        _context.simpleScheduler().addEvent(new PublishToNewInbound(peer), 0);
    548548    }
    549549    private class PublishToNewInbound implements SimpleTimer.TimedEvent {
     
    697697                }
    698698        }
    699         SimpleScheduler.getInstance().addEvent(new FailIntroduction(state, nonce), INTRO_ATTEMPT_TIMEOUT);
     699        _context.simpleScheduler().addEvent(new FailIntroduction(state, nonce), INTRO_ATTEMPT_TIMEOUT);
    700700        state.setIntroNonce(nonce);
    701701        _context.statManager().addRateData("udp.sendIntroRelayRequest", 1, 0);
  • router/java/src/net/i2p/router/transport/udp/PeerTestManager.java

    r00f9fea rb4a50ed  
    159159        sendTestToBob();
    160160       
    161         SimpleScheduler.getInstance().addEvent(new ContinueTest(), RESEND_TIMEOUT);
     161        _context.simpleScheduler().addEvent(new ContinueTest(), RESEND_TIMEOUT);
    162162    }
    163163   
     
    184184                        sendTestToCharlie();
    185185                    }
    186                     SimpleScheduler.getInstance().addEvent(ContinueTest.this, RESEND_TIMEOUT);
     186                    _context.simpleScheduler().addEvent(ContinueTest.this, RESEND_TIMEOUT);
    187187                }
    188188            }
     
    539539            if (isNew) {
    540540                _activeTests.put(Long.valueOf(nonce), state);
    541                 SimpleScheduler.getInstance().addEvent(new RemoveTest(nonce), MAX_CHARLIE_LIFETIME);
     541                _context.simpleScheduler().addEvent(new RemoveTest(nonce), MAX_CHARLIE_LIFETIME);
    542542            }
    543543
     
    618618            if (isNew) {
    619619                _activeTests.put(Long.valueOf(nonce), state);
    620                 SimpleScheduler.getInstance().addEvent(new RemoveTest(nonce), MAX_CHARLIE_LIFETIME);
     620                _context.simpleScheduler().addEvent(new RemoveTest(nonce), MAX_CHARLIE_LIFETIME);
    621621            }
    622622           
  • router/java/src/net/i2p/router/transport/udp/UDPTransport.java

    r00f9fea rb4a50ed  
    229229        _context.statManager().createRateStat("udp.dropPeerConsecutiveFailures", "How many consecutive failed sends to a peer did we attempt before giving up and reestablishing a new session (lifetime is inactivity perood)", "udp", RATES);
    230230
    231         SimpleScheduler.getInstance().addPeriodicEvent(new PingIntroducers(), MIN_EXPIRE_TIMEOUT * 3 / 4);
     231        _context.simpleScheduler().addPeriodicEvent(new PingIntroducers(), MIN_EXPIRE_TIMEOUT * 3 / 4);
    232232    }
    233233   
     
    833833                    _dropList.add(remote);
    834834                    _context.statManager().addRateData("udp.dropPeerDroplist", 1, 0);
    835                     SimpleScheduler.getInstance().addEvent(new RemoveDropList(remote), DROPLIST_PERIOD);
     835                    _context.simpleScheduler().addEvent(new RemoveDropList(remote), DROPLIST_PERIOD);
    836836                }
    837837                markUnreachable(peerHash);
  • router/java/src/net/i2p/router/tunnel/pool/ParticipatingThrottler.java

    r00f9fea rb4a50ed  
    4343        this.context = ctx;
    4444        this.counter = new ObjectCounter();
    45         SimpleScheduler.getInstance().addPeriodicEvent(new Cleaner(), CLEAN_TIME);
     45        ctx.simpleScheduler().addPeriodicEvent(new Cleaner(), CLEAN_TIME);
    4646    }
    4747
  • router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java

    r00f9fea rb4a50ed  
    436436        // race window with removeTunnels() below
    437437        if (delayOutbound)
    438             SimpleScheduler.getInstance().addEvent(new DelayedStartup(outbound), 1000);
     438            _context.simpleScheduler().addEvent(new DelayedStartup(outbound), 1000);
    439439        else
    440440            outbound.startup();
     
    524524        outboundSettings.setIsInbound(false);
    525525        _outboundExploratory = new TunnelPool(_context, this, outboundSettings, selector);
    526         SimpleScheduler.getInstance().addEvent(new DelayedStartup(_outboundExploratory), 3*1000);
     526        _context.simpleScheduler().addEvent(new DelayedStartup(_outboundExploratory), 3*1000);
    527527       
    528528        // try to build up longer tunnels
Note: See TracChangeset for help on using the changeset viewer.