I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 123b4ca4 authored by zab2's avatar zab2
Browse files

Fix locking on _nextExpire field

parent c944fcce
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment