Package org.redisson.executor
Class RedissonCompletionService<V>
- java.lang.Object
-
- org.redisson.executor.RedissonCompletionService<V>
-
- Type Parameters:
V
- value type
- All Implemented Interfaces:
CompletionService<V>
public class RedissonCompletionService<V> extends Object implements CompletionService<V>
ACompletionService
that uses a suppliedExecutor
to execute tasks. This class arranges that submitted tasks are, upon completion, placed on a queue accessible usingtake
. The class is lightweight enough to be suitable for transient use when processing groups of tasks.- Author:
- Nikita Koksharov
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockingQueue<RFuture<V>>
completionQueue
protected RScheduledExecutorService
executorService
-
Constructor Summary
Constructors Constructor Description RedissonCompletionService(RScheduledExecutorService executorService)
RedissonCompletionService(RScheduledExecutorService executorService, BlockingQueue<RFuture<V>> completionQueue)
-
-
-
Field Detail
-
executorService
protected final RScheduledExecutorService executorService
-
completionQueue
protected final BlockingQueue<RFuture<V>> completionQueue
-
-
Constructor Detail
-
RedissonCompletionService
public RedissonCompletionService(RScheduledExecutorService executorService)
-
RedissonCompletionService
public RedissonCompletionService(RScheduledExecutorService executorService, BlockingQueue<RFuture<V>> completionQueue)
-
-
Method Detail
-
submit
public Future<V> submit(Callable<V> task)
- Specified by:
submit
in interfaceCompletionService<V>
-
submit
public Future<V> submit(Runnable task, V result)
- Specified by:
submit
in interfaceCompletionService<V>
-
take
public Future<V> take() throws InterruptedException
- Specified by:
take
in interfaceCompletionService<V>
- Throws:
InterruptedException
-
poll
public Future<V> poll()
- Specified by:
poll
in interfaceCompletionService<V>
-
poll
public Future<V> poll(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
poll
in interfaceCompletionService<V>
- Throws:
InterruptedException
-
-