|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectibspan.ecap.shared.util.ScheduledExecutorCompletionService<RES>
RES
- the type of the results returned by the executed taskspublic class ScheduledExecutorCompletionService<RES>
A CompletionService
that uses a supplied
ScheduledExecutorService
to schedule and execute tasks. This class
arranges that submitted tasks are, upon completion, placed on a queue
accessible using take. This class is based on the
ExecutorCompletionService
.
Constructor Summary | |
---|---|
ScheduledExecutorCompletionService(java.util.concurrent.ScheduledExecutorService scheduler)
Creates a ScheduledExecutorCompletionService using the supplied scheduler for base task execution and a LinkedBlockingQueue as a completion
queue. |
|
ScheduledExecutorCompletionService(java.util.concurrent.ScheduledExecutorService scheduler,
java.util.concurrent.BlockingQueue<java.util.concurrent.Future<RES>> completionQueue)
Creates a ScheduledExecutorCompletionService using the supplied scheduler for base task execution and the supplied queue as its completion queue. |
Method Summary | |
---|---|
java.util.concurrent.Future<RES> |
poll()
|
java.util.concurrent.Future<RES> |
poll(long timeout,
java.util.concurrent.TimeUnit unit)
|
java.util.concurrent.ScheduledFuture<RES> |
schedule(java.util.concurrent.Callable<RES> callable,
long delay,
java.util.concurrent.TimeUnit unit)
Creates and executes a ScheduledFuture that becomes enabled after the given delay. |
java.util.concurrent.ScheduledFuture<?> |
schedule(java.lang.Runnable command,
long delay,
java.util.concurrent.TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the given delay. |
java.util.concurrent.Future<RES> |
submit(java.util.concurrent.Callable<RES> task)
|
java.util.concurrent.Future<RES> |
submit(java.lang.Runnable task,
RES result)
|
java.util.concurrent.Future<RES> |
take()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScheduledExecutorCompletionService(java.util.concurrent.ScheduledExecutorService scheduler)
LinkedBlockingQueue
as a completion
queue.
scheduler
- the scheduler to use
java.lang.NullPointerException
- if scheduler is nullpublic ScheduledExecutorCompletionService(java.util.concurrent.ScheduledExecutorService scheduler, java.util.concurrent.BlockingQueue<java.util.concurrent.Future<RES>> completionQueue)
scheduler
- the scheduler to usecompletionQueue
- the queue to use as the completion queue normally one
dedicated for use by this service
java.lang.NullPointerException
- if scheduler or completionQueue are nullMethod Detail |
---|
public java.util.concurrent.Future<RES> submit(java.util.concurrent.Callable<RES> task)
submit
in interface java.util.concurrent.CompletionService<RES>
public java.util.concurrent.Future<RES> submit(java.lang.Runnable task, RES result)
submit
in interface java.util.concurrent.CompletionService<RES>
public java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable command, long delay, java.util.concurrent.TimeUnit unit)
command
- the task to execute.delay
- the time from now to delay execution.unit
- the time unit of the delay parameter.
RejectedExecutionException
- if task cannot be scheduled for execution.
java.lang.NullPointerException
- if command is nullpublic java.util.concurrent.ScheduledFuture<RES> schedule(java.util.concurrent.Callable<RES> callable, long delay, java.util.concurrent.TimeUnit unit)
callable
- the function to execute.delay
- the time from now to delay execution.unit
- the time unit of the delay parameter.
RejectedExecutionException
- if task cannot be scheduled for execution.
java.lang.NullPointerException
- if callable is nullpublic java.util.concurrent.Future<RES> take() throws java.lang.InterruptedException
take
in interface java.util.concurrent.CompletionService<RES>
java.lang.InterruptedException
public java.util.concurrent.Future<RES> poll()
poll
in interface java.util.concurrent.CompletionService<RES>
public java.util.concurrent.Future<RES> poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
poll
in interface java.util.concurrent.CompletionService<RES>
java.lang.InterruptedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |