public ThirtySecondsCache(MetaBroadcaster metaBroadcaster, AtmosphereConfig config) { this.metaBroadcaster = metaBroadcaster; ExecutorsFactory.getScheduler(config).scheduleAtFixedRate(this, 0, 30, TimeUnit.SECONDS); }
private void start() { if (future != null) { future.cancel(false); } if (maxInactiveTime > 0) { logger.info("{} started with idle timeout set to {}", IdleResourceInterceptor.class.getSimpleName(), maxInactiveTime); future = ExecutorsFactory.getScheduler(config).scheduleAtFixedRate(new Runnable() { public void run() { idleResources(); } }, 0, 2, TimeUnit.SECONDS); } }
@Override public void configure(AtmosphereConfig config) { Object o = config.properties().get("shared"); if (o != null) { isShared = Boolean.parseBoolean(o.toString()); } if (isShared) { reaper = ExecutorsFactory.getScheduler(config); } else { reaper = Executors.newSingleThreadScheduledExecutor(); } this.config = config; }
protected synchronized void configExecutors() { if (shared) { handleExecutors = false; isExecutorShared = true; isAsyncExecutorShared = true; } executorService = ExecutorsFactory.getMessageDispatcher(config, broadcasterId); asyncWriteService = ExecutorsFactory.getAsyncOperationExecutor(config, broadcasterId); scheduler = ExecutorsFactory.getScheduler(config); }
@Override public void configure(AtmosphereConfig config) { Object o = config.properties().get("shared"); if (o != null) { shared = Boolean.parseBoolean(o.toString()); } if (shared) { taskScheduler = ExecutorsFactory.getScheduler(config); } else { taskScheduler = Executors.newSingleThreadScheduledExecutor(); } clientIdleTime = TimeUnit.SECONDS.toMillis( Long.valueOf(config.getInitParameter(UUIDBROADCASTERCACHE_CLIENT_IDLETIME, "60"))); invalidateCacheInterval = TimeUnit.SECONDS.toMillis( Long.valueOf(config.getInitParameter(UUIDBROADCASTERCACHE_IDLE_CACHE_INTERVAL, "30"))); uuidProvider = config.uuidProvider(); }
@Override public void configure(AtmosphereConfig config) { factory = config.getBroadcasterFactory(); factory.addBroadcasterListener(new B()); stateTracker = ExecutorsFactory.getScheduler(config); String s = config.getInitParameter(STATE_RECOVERY_TIMEOUT); if (s != null) { timeout = Long.parseLong(s); } startStateTracker(); logger.trace("{} started.", AtmosphereResourceStateRecovery.class.getName()); }
@Override public void setBroadcasterConfig(BroadcasterConfig bc) { this.bc = bc; bc.setExecutorService(null, false).setAsyncWriteService(null, false) .setScheduledExecutorService(ExecutorsFactory.getScheduler(config)); }
heartBeat = ExecutorsFactory.getScheduler(config);
@Override protected BroadcasterConfig createBroadcasterConfig(AtmosphereConfig config) { BroadcasterConfig bc = (BroadcasterConfig) config.properties().get(BroadcasterConfig.class.getName()); if (bc == null) { bc = new BroadcasterConfig(config.framework().broadcasterFilters(), config, false, getID()) .init() .setScheduledExecutorService(ExecutorsFactory.getScheduler(config)); } return bc; }
/** * All proprietary Comet based {@link Servlet} must invoke the cancelled method when the underlying WebServer * detect that the client closed the connection. * * @param req the {@link AtmosphereRequest} * @param res the {@link AtmosphereResponse} * @return action the Action operation. * @throws java.io.IOException * @throws javax.servlet.ServletException */ public Action cancelled(final AtmosphereRequest req, final AtmosphereResponse res) throws IOException, ServletException { logger.trace("Cancelling {}", req); final AtmosphereResourceImpl r = AtmosphereResourceImpl.class.cast(req.resource()); // Leave a chance to the client to send the disconnect message before processing the connection if (closingTime > 0) { ExecutorsFactory.getScheduler(config).schedule(new Callable<Object>() { @Override public Object call() throws Exception { endRequest(r, true); return null; } }, closingTime, TimeUnit.MILLISECONDS); } else { if (completeLifecycle(req.resource(), true)) { config.framework().notify(Action.TYPE.CANCELLED, req, res); } } return cancelledAction; }
scheduler = ExecutorsFactory.getScheduler(config); optimizeMapping();
completeLifecycle = false; logger.debug("Delaying closing operation for firefox and resource {}", resource.uuid()); ExecutorsFactory.getScheduler(framework.getAtmosphereConfig()).schedule(new Callable<Object>() { @Override public Object call() throws Exception {
AtmosphereCoordinator() { framework = new AtmosphereFramework(); asynchronousProcessor = new NettyCometSupport(framework().getAtmosphereConfig()); framework.setAsyncSupport(asynchronousProcessor); suspendTimer = ExecutorsFactory.getScheduler(framework.getAtmosphereConfig()); mapper = framework.endPointMapper(); }
private AtmosphereCoordinator() { framework = new AtmosphereFramework(); asynchronousProcessor = new NettyCometSupport(framework().getAtmosphereConfig()); framework.setAsyncSupport(asynchronousProcessor); suspendTimer = ExecutorsFactory.getScheduler(framework.getAtmosphereConfig()); mapper = framework.endPointMapper(); }