forked from I2P_Developers/i2p.i2p
* Streaming: Scheduler cleanup
This commit is contained in:
@@ -11,11 +11,11 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
class SchedulerChooser {
|
||||
private I2PAppContext _context;
|
||||
private Log _log;
|
||||
private TaskScheduler _nullScheduler;
|
||||
private final I2PAppContext _context;
|
||||
private final Log _log;
|
||||
private final TaskScheduler _nullScheduler;
|
||||
/** list of TaskScheduler objects */
|
||||
private List _schedulers;
|
||||
private final List _schedulers;
|
||||
|
||||
public SchedulerChooser(I2PAppContext context) {
|
||||
_context = context;
|
||||
@@ -48,8 +48,9 @@ class SchedulerChooser {
|
||||
rv.add(new SchedulerDead(_context));
|
||||
return rv;
|
||||
}
|
||||
|
||||
private class NullScheduler implements TaskScheduler {
|
||||
private Log _log;
|
||||
private final Log _log;
|
||||
public NullScheduler() {
|
||||
_log = _context.logManager().getLog(NullScheduler.class);
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package net.i2p.client.streaming;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* <p>Scheduler used for after both sides have had their close packets
|
||||
@@ -25,10 +24,8 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
class SchedulerClosed extends SchedulerImpl {
|
||||
private Log _log;
|
||||
public SchedulerClosed(I2PAppContext ctx) {
|
||||
super(ctx);
|
||||
_log = ctx.logManager().getLog(SchedulerClosed.class);
|
||||
}
|
||||
|
||||
public boolean accept(Connection con) {
|
||||
|
@@ -27,10 +27,9 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
class SchedulerClosing extends SchedulerImpl {
|
||||
private Log _log;
|
||||
|
||||
public SchedulerClosing(I2PAppContext ctx) {
|
||||
super(ctx);
|
||||
_log = ctx.logManager().getLog(SchedulerClosing.class);
|
||||
}
|
||||
|
||||
public boolean accept(Connection con) {
|
||||
|
@@ -30,10 +30,9 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
class SchedulerConnectedBulk extends SchedulerImpl {
|
||||
private Log _log;
|
||||
|
||||
public SchedulerConnectedBulk(I2PAppContext ctx) {
|
||||
super(ctx);
|
||||
_log = ctx.logManager().getLog(SchedulerConnectedBulk.class);
|
||||
}
|
||||
|
||||
public boolean accept(Connection con) {
|
||||
|
@@ -27,11 +27,9 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
class SchedulerConnecting extends SchedulerImpl {
|
||||
private Log _log;
|
||||
|
||||
public SchedulerConnecting(I2PAppContext ctx) {
|
||||
super(ctx);
|
||||
_log = ctx.logManager().getLog(SchedulerConnecting.class);
|
||||
}
|
||||
|
||||
public boolean accept(Connection con) {
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package net.i2p.client.streaming;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* <p>Scheduler used for after the final timeout has passed or the
|
||||
@@ -24,10 +23,9 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
class SchedulerDead extends SchedulerImpl {
|
||||
private Log _log;
|
||||
|
||||
public SchedulerDead(I2PAppContext ctx) {
|
||||
super(ctx);
|
||||
_log = ctx.logManager().getLog(SchedulerDead.class);
|
||||
}
|
||||
|
||||
public boolean accept(Connection con) {
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package net.i2p.client.streaming;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* <p>Scheduler used after we've locally done a hard disconnect,
|
||||
@@ -25,10 +24,9 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
class SchedulerHardDisconnected extends SchedulerImpl {
|
||||
private Log _log;
|
||||
|
||||
public SchedulerHardDisconnected(I2PAppContext ctx) {
|
||||
super(ctx);
|
||||
_log = ctx.logManager().getLog(SchedulerHardDisconnected.class);
|
||||
}
|
||||
|
||||
public boolean accept(Connection con) {
|
||||
|
@@ -8,8 +8,8 @@ import net.i2p.util.SimpleScheduler;
|
||||
* Base scheduler
|
||||
*/
|
||||
abstract class SchedulerImpl implements TaskScheduler {
|
||||
protected I2PAppContext _context;
|
||||
private Log _log;
|
||||
protected final I2PAppContext _context;
|
||||
protected final Log _log;
|
||||
|
||||
public SchedulerImpl(I2PAppContext ctx) {
|
||||
_context = ctx;
|
||||
@@ -17,6 +17,6 @@ abstract class SchedulerImpl implements TaskScheduler {
|
||||
}
|
||||
|
||||
protected void reschedule(long msToWait, Connection con) {
|
||||
SimpleScheduler.getInstance().addEvent(con.getConnectionEvent(), msToWait);
|
||||
_context.simpleScheduler().addEvent(con.getConnectionEvent(), msToWait);
|
||||
}
|
||||
}
|
||||
|
@@ -22,11 +22,9 @@ import net.i2p.util.Log;
|
||||
* </ul>
|
||||
*/
|
||||
class SchedulerPreconnect extends SchedulerImpl {
|
||||
private Log _log;
|
||||
|
||||
public SchedulerPreconnect(I2PAppContext ctx) {
|
||||
super(ctx);
|
||||
_log = ctx.logManager().getLog(SchedulerPreconnect.class);
|
||||
}
|
||||
|
||||
public boolean accept(Connection con) {
|
||||
|
@@ -9,11 +9,9 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
class SchedulerReceived extends SchedulerImpl {
|
||||
private Log _log;
|
||||
|
||||
public SchedulerReceived(I2PAppContext ctx) {
|
||||
super(ctx);
|
||||
_log = ctx.logManager().getLog(SchedulerReceived.class);
|
||||
}
|
||||
|
||||
public boolean accept(Connection con) {
|
||||
|
Reference in New Issue
Block a user