public boolean isShutdown() { return threadPoolExecutor.isShutdown(); }
/** * Returns true if the channel is currently running. The channel can be started and * stopped by calling the start() and stop() methods. * * @return true if the channel is running. */ public boolean isRunning() { return !executor.isShutdown(); }
@Override public boolean isShutdown() { return executor.isShutdown(); }
public boolean isShutdown() { return exec.isShutdown(); }
/** * Executes task r in the caller's thread, unless the executor * has been shut down, in which case the task is discarded. * * @param r the runnable task requested to be executed * @param e the executor attempting to execute this task */ public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { if (!e.isShutdown()) { r.run(); } } }
private void internalInit() { if (mThreadPoolExecutor != null && !mThreadPoolExecutor.isShutdown()) { mThreadPoolExecutor.shutdownNow(); } mThreadPoolExecutor = new ThreadPoolExecutor( CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE_SECONDS, TimeUnit.SECONDS, sPoolWorkQueue, sThreadFactory); mThreadPoolExecutor.allowCoreThreadTimeOut(true); }
public void rejectedExecution(Runnable task, ThreadPoolExecutor executor) { while (true) { if (executor.isShutdown()) throw new RejectedExecutionException("ThreadPoolExecutor has shut down"); try { if (queue.offer(task, 1000, TimeUnit.MILLISECONDS)) break; } catch (InterruptedException e) { // NOP } } } }
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { if(!executor.isShutdown()) { handler.rejectedExecution(r, executor); } } }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { if (!e.isShutdown()) { Runnable last = e.getQueue().poll(); if (last instanceof RefreshTask) { RefreshTask lastTask = (RefreshTask) last; refreshing.remove(lastTask.getCacheKey()); } e.execute(r); } }
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (messageExecutor.isShutdown()) { return; } if (LOGGER.isInfoEnabled()) { LOGGER.info("channel inactive:" + ctx.channel()); } releaseChannel(ctx.channel(), NetUtil.toStringAddress(ctx.channel().remoteAddress())); super.channelInactive(ctx); }
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (messageExecutor.isShutdown()) { return; } if (LOGGER.isInfoEnabled()) { LOGGER.info("channel inactive:" + ctx.channel()); } releaseChannel(ctx.channel(), NetUtil.toStringAddress(ctx.channel().remoteAddress())); super.channelInactive(ctx); }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { String msg = String.format("Thread pool is EXHAUSTED!" + " Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d)," + " Executor status:(isShutdown:%s, isTerminated:%s, isTerminating:%s), in %s://%s:%d!", threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(), e.getLargestPoolSize(), e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(), e.isTerminating(), url.getProtocol(), url.getIp(), url.getPort()); logger.warn(msg); dumpJStack(); throw new RejectedExecutionException(msg); }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { String msg = String.format("Thread pool is EXHAUSTED!" + " Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d)," + " Executor status:(isShutdown:%s, isTerminated:%s, isTerminating:%s), in %s://%s:%d!", threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(), e.getLargestPoolSize(), e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(), e.isTerminating(), url.getProtocol(), url.getIp(), url.getPort()); logger.warn(msg); dumpJStack(); throw new RejectedExecutionException(msg); }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { String msg = String.format( "Thread pool is EXHAUSTED!" + " Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d)," + " Executor status:(isShutdown:%s, isTerminated:%s, isTerminating:%s)!", threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(), e.getLargestPoolSize(), e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(), e.isTerminating()); logger.warn(msg); dummper.tryThreadDump(null); throw new RejectedExecutionException(msg); }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { LOGGER.warn("one task rejected, poolConfig={}, poolInfo={}", poolConfig, Utils.getPoolInfo(e)); if (!dumping) { dumping = true; dumpJVMInfo(); } if (rejectedPolicy == REJECTED_POLICY_ABORT) { throw new RejectedExecutionException("one task rejected, pool=" + poolConfig.getName()); } else if (rejectedPolicy == REJECTED_POLICY_CALLER_RUNS) { if (!e.isShutdown()) { r.run(); } } }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString()); dumpJvmInfoIfNeeded(); if (!e.isShutdown()) { try { e.getQueue().put(r); } catch (InterruptedException ignored) { /* should not be interrupted */ } } } }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString()); dumpJvmInfoIfNeeded(); if (!e.isShutdown()) { try { e.getQueue().put(r); } catch (InterruptedException ignored) { /* should not be interrupted */ } } } }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString()); dumpJvmInfoIfNeeded(); if (!e.isShutdown()) { r.run(); } } }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString()); dumpJvmInfoIfNeeded(); if (!e.isShutdown()) { r.run(); } } }
/** * Channel inactive. * * @param ctx the ctx * @throws Exception the exception */ @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { debugLog("inactive:" + ctx); if (messageExecutor.isShutdown()) { return; } handleDisconnect(ctx); super.channelInactive(ctx); }