(ExecutorFilter) session.getFilterChain().get(EXECUTOR_FILTER_NAME); if (executorFilter != null) { Executor executor = executorFilter.getExecutor(); if (executor instanceof OrderedThreadPoolExecutor) { tmpQueuevedEvents += ((OrderedThreadPoolExecutor) executor).getActiveCount();
( (ThreadPoolExecutor) executorFilter.getExecutor()).setCorePoolSize( ( configuration.getMaxThreadPoolSize() / 4 ) + 1 ); ( (ThreadPoolExecutor) executorFilter.getExecutor()).setMaximumPoolSize( ( configuration.getMaxThreadPoolSize() ) );
final ExecutorFilter executorFilter = new ExecutorFilter( initialSize, configuration.getMaxThreadPoolSize(), 60, TimeUnit.SECONDS ); final ThreadPoolExecutor eventExecutor = (ThreadPoolExecutor) executorFilter.getExecutor(); final ThreadFactory threadFactory = new NamedThreadFactory( name + "-thread-", eventExecutor.getThreadFactory(), true, null ); eventExecutor.setThreadFactory( threadFactory );
/** * {@inheritDoc} */ @Override public boolean isTerminating() { synchronized (workers) { return isShutdown() && !isTerminated(); } }
@Override public boolean remove(Runnable task) { boolean removed = super.remove(task); if (removed) { getQueueHandler().polled(this, (IoEvent) task); } return removed; }
@Override public boolean isTerminating() { synchronized (workers) { return isShutdown() && !isTerminated(); } }
/** * Creates a new instance with the specified {@link Executor}. * * @param executor the user's managed Executor to use in this filter */ public ExecutorFilter(Executor executor) { // Initialize the filter init(executor, NOT_MANAGEABLE_EXECUTOR); }
/** * Creates a new IoEventQueueThrottle instance */ public IoEventQueueThrottle() { this(new DefaultIoEventSizeEstimator(), 65536); }
/** * {@inheritDoc} */ @Override public long getTaskCount() { return getCompletedTaskCount(); }
/** * @inheritedDoc */ @Override public void operationComplete(WriteFuture future) { queueHandler.polled(WriteRequestFilter.this, e); } });
/** * Creates a new instance with a new default {@link IoEventQueueThrottle}. */ public WriteRequestFilter() { this(new IoEventQueueThrottle()); }
/** * {@inheritDoc} */ @Override public boolean isTerminating() { synchronized (workers) { return isShutdown() && !isTerminated(); } }
@Override public boolean remove(Runnable task) { boolean removed = super.remove(task); if (removed) { getQueueHandler().polled(this, (IoEvent) task); } return removed; }
/** * Creates a new instance with the specified {@link Executor}. * * @param executor the user's managed Executor to use in this filter * @param eventTypes The event for which the executor will be used */ public ExecutorFilter(Executor executor, IoEventType... eventTypes) { // Initialize the filter init(executor, NOT_MANAGEABLE_EXECUTOR, eventTypes); }
/** * Creates a new IoEventQueueThrottle instance * * @param threshold The events threshold */ public IoEventQueueThrottle(int threshold) { this(new DefaultIoEventSizeEstimator(), threshold); }
/** * {@inheritDoc} */ @Override public long getTaskCount() { return getCompletedTaskCount(); }
/** * {@inheritDoc} */ @Override public boolean isTerminating() { synchronized (workers) { return isShutdown() && !isTerminated(); } }
/** * Creates a new instance with the specified {@link Executor}. * * @param executor the user's managed Executor to use in this filter * @param eventTypes The event for which the executor will be used */ public ExecutorFilter(Executor executor, IoEventType... eventTypes) { // Initialize the filter init(executor, NOT_MANAGEABLE_EXECUTOR, eventTypes); }
/** * Creates a new IoEventQueueThrottle instance */ public IoEventQueueThrottle() { this(new DefaultIoEventSizeEstimator(), 65536); }
/** * Creates a new instance with the specified {@link Executor}. * * @param executor the user's managed Executor to use in this filter */ public ExecutorFilter(Executor executor) { // Initialize the filter init(executor, NOT_MANAGEABLE_EXECUTOR); }