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 java.lang.Object

For creating instances of a AsyncCompleter.


Constructor Summary
AsyncCompleter.Builder(java.util.concurrent.Executor executor)
          Create a Builder with the supplied Executor
 
Method Summary
 AsyncCompleter build()
           
 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 executed 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
                              java.util.concurrent.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)

limitParallelExecutionTo

public AsyncCompleter limitParallelExecutionTo(int limit)
Create a AsyncCompleter that limits the number of jobs executed 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, or 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 © 2011 Atlassian. All Rights Reserved.