* SimpleScheduler: New replacement for SimpleTimer when events

will not be rescheduled or cancelled, to reduce SimpleTimer
      lock contention
This commit is contained in:
zzz
2009-01-31 14:22:07 +00:00
parent d75e1deae7
commit a5ab6f576d
18 changed files with 207 additions and 34 deletions

View File

@ -24,6 +24,7 @@ import net.i2p.data.Destination;
import net.i2p.data.Hash;
import net.i2p.util.EepGet;
import net.i2p.util.Log;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer;
/**
@ -183,7 +184,7 @@ public class I2PSnarkUtil {
synchronized (_shitlist) {
_shitlist.add(dest);
}
SimpleTimer.getInstance().addEvent(new Unshitlist(dest), 10*60*1000);
SimpleScheduler.getInstance().addEvent(new Unshitlist(dest), 10*60*1000);
throw new IOException("Unable to reach the peer " + peer + ": " + ie.getMessage());
}
}

View File

@ -28,6 +28,7 @@ import java.util.List;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer;
class PeerConnectionOut implements Runnable
@ -215,7 +216,7 @@ class PeerConnectionOut implements Runnable
private void addMessage(Message m)
{
if (m.type == Message.PIECE)
SimpleTimer.getInstance().addEvent(new RemoveTooSlow(m), SEND_TIMEOUT);
SimpleScheduler.getInstance().addEvent(new RemoveTooSlow(m), SEND_TIMEOUT);
synchronized(sendQueue)
{
sendQueue.add(m);