Fixes - Sweep mechanism can be stopped with JVM Bug?
Rescheduling in a finally block so that exceptions
eventually thrown by sweep() won't stop sweeping.
@@ -33,7 +33,6 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
-
import javax.servlet.http.HttpServletRequest;
import org.cometd.bayeux.Bayeux;
@@ -111,13 +110,16 @@ public class BayeuxServerImpl extends AbstractLifeCycle implements BayeuxServer,
if (sweepPeriodOption < 0) {
sweepPeriodOption = defaultSweepPeriod;
}
- final long sweepPeriod = sweepPeriodOption;
+ long sweepPeriod = sweepPeriodOption;
schedule(new Runnable() {
@Override
public void run() {
+ try {
sweep();
+ } finally {
schedule(this, sweepPeriod);
}
+ }
}, sweepPeriod);
_validation = getOption(VALIDATE_MESSAGE_FIELDS_OPTION, true);
