/** * Construct a new instance using a bounded FIFO queue of the given size and a handoff reject policy. * * @param parent the parent executor * @param queueLength the fixed length of the queue to use to hold tasks * @param blocking {@code true} if rejected tasks should block, {@code false} if rejected tasks should be handed off * @param handoffExecutor the executor to hand tasks to if the queue is full */ public OrderedExecutor(final Executor parent, final int queueLength, final boolean blocking, final Executor handoffExecutor) { this(parent, new ArrayQueue<Runnable>(queueLength), blocking, handoffExecutor); }
/** * Construct a new instance using a bounded FIFO queue of the given size and a handoff reject policy. * * @param parent the parent executor * @param queueLength the fixed length of the queue to use to hold tasks * @param handoffExecutor the executor to hand tasks to if the queue is full */ public OrderedExecutor(final Executor parent, final int queueLength, final Executor handoffExecutor) { this(parent, new ArrayQueue<Runnable>(queueLength), false, handoffExecutor); }
/** * Construct a new instance using a bounded FIFO queue of the given size and a blocking reject policy. * * @param parent the parent to delegate tasks to * @param queueLength the fixed length of the queue to use to hold tasks */ public OrderedExecutor(final Executor parent, final int queueLength) { this(parent, new ArrayQueue<Runnable>(queueLength), true, null); }
/** * Create a new instance. * * @param coreThreads the number of threads to create before enqueueing tasks * @param maxThreads the maximum number of threads to create * @param keepAliveTime the amount of time that an idle thread should remain active * @param keepAliveTimeUnit the unit of time for {@code keepAliveTime} * @param queueLength the fixed queue length to use for tasks * @param threadFactory the thread factory to use for new threads * @param blocking {@code true} if the executor should block when the queue is full and no threads are available, {@code false} to use the handoff executor * @param handoffExecutor the executor which is called when blocking is disabled and a task cannot be accepted, or {@code null} to reject the task */ public QueueExecutor(final int coreThreads, final int maxThreads, final long keepAliveTime, final TimeUnit keepAliveTimeUnit, final int queueLength, final ThreadFactory threadFactory, final boolean blocking, final Executor handoffExecutor) { this(coreThreads, maxThreads, keepAliveTime, keepAliveTimeUnit, new ArrayQueue<Runnable>(queueLength), threadFactory, blocking, handoffExecutor); }
/** * Construct a new instance using a bounded FIFO queue of the given size and a handoff reject policy. * * @param parent the parent executor * @param queueLength the fixed length of the queue to use to hold tasks * @param handoffExecutor the executor to hand tasks to if the queue is full */ public OrderedExecutor(final Executor parent, final int queueLength, final Executor handoffExecutor) { this(parent, new ArrayQueue<Runnable>(queueLength), false, handoffExecutor); }
/** * Construct a new instance using a bounded FIFO queue of the given size and a blocking reject policy. * * @param parent the parent to delegate tasks to * @param queueLength the fixed length of the queue to use to hold tasks */ public OrderedExecutor(final Executor parent, final int queueLength) { this(parent, new ArrayQueue<Runnable>(queueLength), true, null); }
/** * Construct a new instance using a bounded FIFO queue of the given size and a handoff reject policy. * * @param parent the parent executor * @param queueLength the fixed length of the queue to use to hold tasks * @param blocking {@code true} if rejected tasks should block, {@code false} if rejected tasks should be handed off * @param handoffExecutor the executor to hand tasks to if the queue is full */ public OrderedExecutor(final Executor parent, final int queueLength, final boolean blocking, final Executor handoffExecutor) { this(parent, new ArrayQueue<Runnable>(queueLength), blocking, handoffExecutor); }
/** * Construct a new instance using a bounded FIFO queue of the given size and a blocking reject policy. * * @param parent the parent to delegate tasks to * @param queueLength the fixed length of the queue to use to hold tasks */ public OrderedExecutor(final Executor parent, final int queueLength) { this(parent, new ArrayQueue<Runnable>(queueLength), true, null); }
/** * Construct a new instance using a bounded FIFO queue of the given size and a handoff reject policy. * * @param parent the parent executor * @param queueLength the fixed length of the queue to use to hold tasks * @param handoffExecutor the executor to hand tasks to if the queue is full */ public OrderedExecutor(final Executor parent, final int queueLength, final Executor handoffExecutor) { this(parent, new ArrayQueue<Runnable>(queueLength), false, handoffExecutor); }
/** * Construct a new instance using a bounded FIFO queue of the given size and a handoff reject policy. * * @param parent the parent executor * @param queueLength the fixed length of the queue to use to hold tasks * @param blocking {@code true} if rejected tasks should block, {@code false} if rejected tasks should be handed off * @param handoffExecutor the executor to hand tasks to if the queue is full */ public OrderedExecutor(final Executor parent, final int queueLength, final boolean blocking, final Executor handoffExecutor) { this(parent, new ArrayQueue<Runnable>(queueLength), blocking, handoffExecutor); }
/** * Create a new instance. * * @param coreThreads the number of threads to create before enqueueing tasks * @param maxThreads the maximum number of threads to create * @param keepAliveTime the amount of time that an idle thread should remain active * @param keepAliveTimeUnit the unit of time for {@code keepAliveTime} * @param queueLength the fixed queue length to use for tasks * @param threadFactory the thread factory to use for new threads * @param blocking {@code true} if the executor should block when the queue is full and no threads are available, {@code false} to use the handoff executor * @param handoffExecutor the executor which is called when blocking is disabled and a task cannot be accepted, or {@code null} to reject the task */ public QueueExecutor(final int coreThreads, final int maxThreads, final long keepAliveTime, final TimeUnit keepAliveTimeUnit, final int queueLength, final ThreadFactory threadFactory, final boolean blocking, final Executor handoffExecutor) { this(coreThreads, maxThreads, keepAliveTime, keepAliveTimeUnit, new ArrayQueue<Runnable>(queueLength), threadFactory, blocking, handoffExecutor); }
/** * Create a new instance. * * @param coreThreads the number of threads to create before enqueueing tasks * @param maxThreads the maximum number of threads to create * @param keepAliveTime the amount of time that an idle thread should remain active * @param keepAliveTimeUnit the unit of time for {@code keepAliveTime} * @param queueLength the fixed queue length to use for tasks * @param threadFactory the thread factory to use for new threads * @param blocking {@code true} if the executor should block when the queue is full and no threads are available, {@code false} to use the handoff executor * @param handoffExecutor the executor which is called when blocking is disabled and a task cannot be accepted, or {@code null} to reject the task */ public QueueExecutor(final int coreThreads, final int maxThreads, final long keepAliveTime, final TimeUnit keepAliveTimeUnit, final int queueLength, final ThreadFactory threadFactory, final boolean blocking, final Executor handoffExecutor) { this(coreThreads, maxThreads, keepAliveTime, keepAliveTimeUnit, new ArrayQueue<Runnable>(queueLength), threadFactory, blocking, handoffExecutor); }
builder.addConstructorParameter(TimeUnit.class.getName(), builder.createValue(TimeUnit.SECONDS)); builder.addConstructorParameter(Queue.class.getName(), builder.createValue(new ArrayQueue<Runnable>(calculateScaledCount(metaData.getQueueLength())))); final RefMetaData threadFactory = metaData.getThreadFactory(); if (threadFactory != null) {