V
- value typepublic class RedissonCompletionService<V> extends Object implements CompletionService<V>
CompletionService
that uses a supplied Executor
to execute tasks. This class arranges that submitted tasks are,
upon completion, placed on a queue accessible using take
.
The class is lightweight enough to be suitable for transient use
when processing groups of tasks.Modifier and Type | Field and Description |
---|---|
protected BlockingQueue<RFuture<V>> |
completionQueue |
protected RScheduledExecutorService |
executorService |
Constructor and Description |
---|
RedissonCompletionService(RScheduledExecutorService executorService) |
RedissonCompletionService(RScheduledExecutorService executorService,
BlockingQueue<RFuture<V>> completionQueue) |
protected final RScheduledExecutorService executorService
protected final BlockingQueue<RFuture<V>> completionQueue
public RedissonCompletionService(RScheduledExecutorService executorService)
public RedissonCompletionService(RScheduledExecutorService executorService, BlockingQueue<RFuture<V>> completionQueue)
public Future<V> submit(Callable<V> task)
submit
in interface CompletionService<V>
public Future<V> submit(Runnable task, V result)
submit
in interface CompletionService<V>
public Future<V> take() throws InterruptedException
take
in interface CompletionService<V>
InterruptedException
public Future<V> poll()
poll
in interface CompletionService<V>
public Future<V> poll(long timeout, TimeUnit unit) throws InterruptedException
poll
in interface CompletionService<V>
InterruptedException
Copyright © 2014–2018 The Redisson Project. All rights reserved.