protected void startDelayedExecutor() { if (delayedExecutor != null) { delayedExecutor.start(); } }
protected void stopDelayedExecutor() { final DelayedExecutor localDelayedExecutor = delayedExecutor; delayedExecutor = null; if (localDelayedExecutor != null) { localDelayedExecutor.stop(); localDelayedExecutor.destroy(); } final ExecutorService localThreadPool = auxExecutorService; auxExecutorService = null; if (localThreadPool != null) { localThreadPool.shutdownNow(); } }
public IdleExecutor(ExecutorService idleTimeoutExecutorService) { this.idleTimeoutDelayedExecutor = new DelayedExecutor(idleTimeoutExecutorService); }
@Override public void close() { try { connectionManager.destroy(); clientTransport.shutdownNow(); final ExecutorService service = clientConfig.executorService(); if (service != null) { service.shutdown(); } if (timeoutExecutor != null) { timeoutExecutor.stop(); timeoutExecutor.getThreadPool().shutdownNow(); } } catch (IOException ignored) { } }
delayedExecutor = new DelayedExecutor(auxExecutorService); delayedExecutor.start();
public void destroy() { stop(); synchronized(sync) { queues.clear(); } }
public SilentConnectionFilter(DelayedExecutor executor, long timeout, TimeUnit timeunit) { this.timeoutMillis = TimeUnit.MILLISECONDS.convert(timeout, timeunit); queue = executor.createDelayQueue( new DelayedExecutor.Worker<Connection>() { @Override public boolean doWork(Connection connection) { connection.closeSilently(); return true; } }, new Resolver()); }
public void dispose() { idleTimeoutDelayedExecutor.destroy(); }
delayedExecutor = new DelayedExecutor(auxExecutorService); delayedExecutor.start();
public void destroy() { stop(); synchronized(sync) { queues.clear(); } }
protected IdleTimeoutFilter(final DelayedExecutor executor, final DelayedExecutor.Worker<Connection> worker, final TimeoutResolver timeoutResolver) { if (executor == null) { throw new IllegalArgumentException("executor cannot be null"); } this.timeoutResolver = timeoutResolver; resolver = new Resolver(); queue = executor.createDelayQueue(worker, resolver); }
@Override public void close() { try { connectionManager.destroy(); clientTransport.shutdownNow(); final ExecutorService service = clientConfig.executorService(); if (service != null) { service.shutdown(); } if (timeoutExecutor != null) { timeoutExecutor.stop(); timeoutExecutor.getThreadPool().shutdownNow(); } } catch (IOException ignored) { } }
@Override public void dispose() { if (transportStarted) { transport.shutdown(); servers.clear(); idleTimeoutDelayedExecutor.destroy(); idleTimeoutExecutorService.shutdown(); } }
protected void stopDelayedExecutor() { if (delayedExecutor != null) { final DelayedExecutor localDelayedExecutor = delayedExecutor; delayedExecutor = null; if (localDelayedExecutor != null) { localDelayedExecutor.stop(); localDelayedExecutor.destroy(); } final ExecutorService localThreadPool = auxExecutorService; auxExecutorService = null; if (localThreadPool != null) { localThreadPool.shutdownNow(); } } }
delayedExecutor = new DelayedExecutor(auxExecutorService); delayedExecutor.start();
@SuppressWarnings({"UnusedDeclaration"}) public static DelayedExecutor createDefaultIdleDelayedExecutor(final long checkInterval, final TimeUnit checkIntervalUnit) { final ExecutorService executor = Executors.newSingleThreadExecutor(new ThreadFactory() { @Override public Thread newThread(Runnable r) { final Thread newThread = new Thread(r); newThread.setName("Grizzly-IdleTimeoutFilter-IdleCheck"); newThread.setDaemon(true); return newThread; } }); return new DelayedExecutor(executor, ((checkInterval > 0) ? checkInterval : 1000L), ((checkIntervalUnit != null) ? checkIntervalUnit : TimeUnit.MILLISECONDS)); }
public void destroy() { stop(); synchronized(sync) { queues.clear(); } }