if (_intervalTimeoutTask != null)
_bayeux.startTimeout(_intervalTimeoutTask, _bayeux.getMaxInterval());
}
} else {
synchronized (this) {
AtmosphereResource oldContinuation = _continuation;
_continuation = continuation;
_bayeux.cancelTimeout(_intervalTimeoutTask);
_accessed = _bayeux.getNow();
if (oldContinuation == null) {
// This is the start of a long poll
} else {
// This is the reload case: there is an outstanding connect,
// and the client issues a new connect.
// We return the old connect via complete() since we do not
// want to resume() otherwise the old connect will be
// redispatched and will overwrite the new connect.
try {
if (oldContinuation.getAtmosphereResourceEvent().isSuspended()) {
((HttpServletResponse) oldContinuation.getResponse()).sendError(HttpServletResponse.SC_REQUEST_TIMEOUT);
oldContinuation.resume();
}
}
catch (Exception e) {
Log.debug(e);
}