Package org.jivesoftware.util
Class ScheduledExecutorCompletionService<V>
java.lang.Object
org.jivesoftware.util.ScheduledExecutorCompletionService<V>
- All Implemented Interfaces:
CompletionService<V>
A CompletionService that allows solvers to be scheduled.
This implementation borrows a lot from
ExecutorCompletionService, which sadly is not designed to be extensible.- Author:
- Guus der Kinderen, guus@goodbytes.nl
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an ExecutorCompletionService using the supplied executor for base task execution and aLinkedBlockingQueueas a completion queue.ScheduledExecutorCompletionService(ScheduledThreadPoolExecutor executor, BlockingQueue<Future<V>> completionQueue) Creates an ExecutorCompletionService using the supplied executor for base task execution and the supplied queue as its completion queue. -
Method Summary
-
Constructor Details
-
ScheduledExecutorCompletionService
Creates an ExecutorCompletionService using the supplied executor for base task execution and aLinkedBlockingQueueas a completion queue.- Parameters:
executor- the executor to use- Throws:
NullPointerException- if executor isnull
-
ScheduledExecutorCompletionService
public ScheduledExecutorCompletionService(ScheduledThreadPoolExecutor executor, BlockingQueue<Future<V>> completionQueue) Creates an ExecutorCompletionService using the supplied executor for base task execution and the supplied queue as its completion queue.- Parameters:
executor- the executor to usecompletionQueue- the queue to use as the completion queue normally one dedicated for use by this service. This queue is treated as unbounded -- failed attemptedQueue.addoperations for completed tasks cause them not to be retrievable.- Throws:
NullPointerException- if executor or completionQueue arenull
-
-
Method Details
-
submit
- Specified by:
submitin interfaceCompletionService<V>- Throws:
RejectedExecutionExceptionNullPointerException
-
submit
- Specified by:
submitin interfaceCompletionService<V>- Throws:
RejectedExecutionExceptionNullPointerException
-
schedule
-
schedule
-
take
- Specified by:
takein interfaceCompletionService<V>- Throws:
InterruptedException
-
poll
- Specified by:
pollin interfaceCompletionService<V>
-
poll
- Specified by:
pollin interfaceCompletionService<V>- Throws:
InterruptedException
-