protected void start() { if (!started.getAndSet(true)) { broadcasterCache = bc.getBroadcasterCache(); broadcasterCache.start(); notifierFuture = bc.getExecutorService().submit(getBroadcastHandler()); asyncWriteFuture = bc.getAsyncWriteService().submit(getAsyncWriteHandler()); } }
protected void onException(Throwable t, final AtmosphereResource<?, ?> r) { logger.debug("onException()", t); if (r instanceof AtmosphereEventLifecycle) { ((AtmosphereEventLifecycle) r) .notifyListeners( new AtmosphereResourceEventImpl((AtmosphereResourceImpl) r, true, false, t)); ((AtmosphereEventLifecycle) r).removeEventListeners(); } /** Make sure we resume the connection on every IOException. */ bc.getAsyncWriteService() .execute( new Runnable() { @Override public void run() { r.resume(); } }); }