forked from I2P_Developers/i2p.i2p
Fix locking on _nextExpire field
This commit is contained in:
@ -258,6 +258,7 @@ public class OutboundMessageRegistry {
|
||||
public void renderStatusHTML(Writer out) throws IOException {}
|
||||
|
||||
private class CleanupTask extends SimpleTimer2.TimedEvent {
|
||||
/** LOCKING: _selectors */
|
||||
private long _nextExpire;
|
||||
|
||||
public CleanupTask() {
|
||||
@ -325,23 +326,28 @@ public class OutboundMessageRegistry {
|
||||
|
||||
if (log) {
|
||||
int e = removing.size();
|
||||
int r = _selectors.size();
|
||||
int r;
|
||||
synchronized(_selectors) {
|
||||
r = _selectors.size();
|
||||
}
|
||||
int a = _activeMessages.size();
|
||||
if (r > 0 || e > 0 || a > 0)
|
||||
_log.debug("Expired: " + e + " remaining: " + r + " active: " + a);
|
||||
}
|
||||
synchronized(this) {
|
||||
synchronized(_selectors) {
|
||||
if (_nextExpire <= now)
|
||||
_nextExpire = now + 10*1000;
|
||||
schedule(_nextExpire - now);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void scheduleExpiration(MessageSelector sel) {
|
||||
public void scheduleExpiration(MessageSelector sel) {
|
||||
long now = _context.clock().now();
|
||||
if ( (_nextExpire <= now) || (sel.getExpiration() < _nextExpire) ) {
|
||||
_nextExpire = sel.getExpiration();
|
||||
reschedule(_nextExpire - now);
|
||||
synchronized(_selectors) {
|
||||
if ( (_nextExpire <= now) || (sel.getExpiration() < _nextExpire) ) {
|
||||
_nextExpire = sel.getExpiration();
|
||||
reschedule(_nextExpire - now);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user