com.atlassian.util.concurrent
Class AsyncCompleter.Builder

java.lang.Object
  extended by com.atlassian.util.concurrent.AsyncCompleter.Builder
Enclosing class:
AsyncCompleter

public static class AsyncCompleter.Builder
extends Object

For creating instances of AsyncCompleter.


Constructor Summary
AsyncCompleter.Builder(Executor executor)
          Create a Builder with the supplied Executor
 
Method Summary
 AsyncCompleter build()
           
 AsyncCompleter.Builder checkCompletionServiceFutureIdentity()
           
 AsyncCompleter.Builder completionServiceFactory(AsyncCompleter.ExecutorCompletionServiceFactory completionServiceFactory)
           
 AsyncCompleter.Builder handleExceptions(ExceptionPolicy policy)
           
 AsyncCompleter.Builder ignoreExceptions()
          Ignore exceptions thrown by any Callables, note will cause nulls in the resulting iterable!
 AsyncCompleter limitParallelExecutionTo(int limit)
          Create a AsyncCompleter that limits the number of jobs submitted to the underlying executor to a hard limit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncCompleter.Builder

public AsyncCompleter.Builder(@NotNull
                              Executor executor)
Create a Builder with the supplied Executor

Parameters:
executor -
Method Detail

ignoreExceptions

public AsyncCompleter.Builder ignoreExceptions()
Ignore exceptions thrown by any Callables, note will cause nulls in the resulting iterable!


handleExceptions

public AsyncCompleter.Builder handleExceptions(ExceptionPolicy policy)

completionServiceFactory

public AsyncCompleter.Builder completionServiceFactory(AsyncCompleter.ExecutorCompletionServiceFactory completionServiceFactory)

checkCompletionServiceFutureIdentity

public AsyncCompleter.Builder checkCompletionServiceFutureIdentity()

limitParallelExecutionTo

public AsyncCompleter limitParallelExecutionTo(int limit)
Create a AsyncCompleter that limits the number of jobs submitted to the underlying executor to a hard limit.

Note: this only makes sense if the underlying executor does not have a limit on the number of threads it will create, on the size of the queue submitted jobs will live in, or where the limit is much higher than this limit.

Parameters:
limit - the number of parallel jobs to execute at any one time
See Also:
for more discussion of how this limit is relevant

build

public AsyncCompleter build()


Copyright © 2014 Atlassian. All Rights Reserved.