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 aLinkedBlockingQueue
as 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 aLinkedBlockingQueue
as 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.add
operations for completed tasks cause them not to be retrievable.- Throws:
NullPointerException
- if executor or completionQueue arenull
-
-
Method Details
-
submit
- Specified by:
submit
in interfaceCompletionService<V>
- Throws:
RejectedExecutionException
NullPointerException
-
submit
- Specified by:
submit
in interfaceCompletionService<V>
- Throws:
RejectedExecutionException
NullPointerException
-
schedule
-
schedule
-
take
- Specified by:
take
in interfaceCompletionService<V>
- Throws:
InterruptedException
-
poll
- Specified by:
poll
in interfaceCompletionService<V>
-
poll
- Specified by:
poll
in interfaceCompletionService<V>
- Throws:
InterruptedException
-