tpObj.put("active", threadPoolProxy.getActiveCount()); tpObj.put("pending", threadPoolProxy.getPendingTasks()); tpObj.put("completed", threadPoolProxy.getCompletedTasks()); tpObj.put("blocked", threadPoolProxy.getCurrentlyBlockedTasks()); tpObj.put("total blocked", threadPoolProxy.getTotalBlockedTasks()); threadPoolArray.put(tpObj);
@Override public synchronized void shutdown() { // synchronized, because there is no way to access super.mainLock, which would be // the preferred way to make this threadsafe if (!isShutdown()) { unregisterMBean(); } super.shutdown(); }
public DebuggableScheduledThreadPoolExecutor(int corePoolSize, String threadPoolName, int priority) { super(corePoolSize, new NamedThreadFactory(threadPoolName, priority)); setRejectedExecutionHandler(rejectedExecutionHandler); }
@Override public synchronized List<Runnable> shutdownNow() { // synchronized, because there is no way to access super.mainLock, which would be // the preferred way to make this threadsafe if (!isShutdown()) { unregisterMBean(); } return super.shutdownNow(); }
private boolean stop() { return get().isStop() && compareAndSet(Work.STOP_SIGNALLED, Work.STOPPED); }
boolean maybeSchedule() { if (pool.spinningCount.get() > 0 || !takeWorkPermit(true)) return false; pool.schedule(new Work(this)); return true; }
public void apply(IMutation mutation, Iterable<InetAddress> targets, AbstractWriteResponseHandler<IMutation> responseHandler, String localDataCenter, ConsistencyLevel consistencyLevel) { StageManager.getStage(Stage.COUNTER_MUTATION) .execute(counterWriteTask(mutation, targets, responseHandler, localDataCenter)); } };
public static ExecutorLocals create(TraceState traceState) { ClientWarn.State clientWarnState = clientWarn.get(); return new ExecutorLocals(traceState, clientWarnState); }
public void execute(Runnable command) { addTask(newTaskFor(command, ExecutorLocals.create())); }
private boolean isSpinning() { return get().isSpinning(); }
protected <T> FutureTask<T> newTaskFor(Runnable runnable, T result, ExecutorLocals locals) { if (locals != null) { if (runnable instanceof LocalSessionFutureTask) return (LocalSessionFutureTask<T>) runnable; return new LocalSessionFutureTask<T>(runnable, result, locals); } if (runnable instanceof FutureTask) return (FutureTask<T>) runnable; return new FutureTask<>(runnable, result); }
protected <T> FutureTask<T> newTaskFor(Runnable runnable, T result, TraceState traceState) { if (traceState != null) { if (runnable instanceof TraceSessionFutureTask) return (TraceSessionFutureTask<T>) runnable; return new TraceSessionFutureTask<T>(runnable, result, traceState); } if (runnable instanceof FutureTask) return (FutureTask<T>) runnable; return new FutureTask<>(runnable, result); }
@Override public synchronized void shutdown() { // synchronized, because there is no way to access super.mainLock, which would be // the preferred way to make this threadsafe if (!isShutdown()) { unregisterMBean(); } super.shutdown(); }
@Override public synchronized List<Runnable> shutdownNow() { // synchronized, because there is no way to access super.mainLock, which would be // the preferred way to make this threadsafe if (!isShutdown()) { unregisterMBean(); } return super.shutdownNow(); }
public DebuggableScheduledThreadPoolExecutor(int corePoolSize, String threadPoolName, int priority) { super(corePoolSize, new NamedThreadFactory(threadPoolName, priority)); setRejectedExecutionHandler(rejectedExecutionHandler); }
public void apply(IMutation mutation, Iterable<InetAddress> targets, AbstractWriteResponseHandler<IMutation> responseHandler, String localDataCenter, ConsistencyLevel consistencyLevel) { StageManager.getStage(Stage.COUNTER_MUTATION) .execute(counterWriteTask(mutation, targets, responseHandler, localDataCenter)); } };
public static ExecutorLocals create(TraceState traceState) { ClientWarn.State clientWarnState = clientWarn.get(); return new ExecutorLocals(traceState, clientWarnState); }
protected <T> FutureTask<T> newTaskFor(Runnable runnable, T result, ExecutorLocals locals) { if (locals != null) { if (runnable instanceof LocalSessionFutureTask) return (LocalSessionFutureTask<T>) runnable; return new LocalSessionFutureTask<T>(runnable, result, locals); } if (runnable instanceof FutureTask) return (FutureTask<T>) runnable; return new FutureTask<>(runnable, result); }
public DebuggableScheduledThreadPoolExecutor(int corePoolSize, String threadPoolName, int priority) { super(corePoolSize, new NamedThreadFactory(threadPoolName, priority)); setRejectedExecutionHandler(rejectedExecutionHandler); }
public static ExecutorLocals create(TraceState traceState) { ClientWarn.State clientWarnState = clientWarn.get(); return new ExecutorLocals(traceState, clientWarnState); }