- All Implemented Interfaces:
- Serializable, Iterable<T>, Collection<T>, BlockingQueue<T>, Queue<T>
@InterfaceAudience.Private
public class StealJobQueue<T>
extends PriorityBlockingQueue<T>
This queue allows a ThreadPoolExecutor to steal jobs from another ThreadPoolExecutor.
This queue also acts as the factory for creating the PriorityBlockingQueue to be used in the
steal-from ThreadPoolExecutor. The behavior of this queue is the same as a normal
PriorityBlockingQueue except the take/poll(long,TimeUnit) methods would also check whether there
are jobs in the steal-from queue if this q ueue is empty.
Note the workers in ThreadPoolExecutor must be pre-started so that they can steal job from the
other queue, otherwise the worker will only be started after there are jobs submitted to main
queue.
- See Also:
- Serialized Form