T - typepublic final class ThreadPoolStage<T> extends AbstractEStage<T>
| Constructor and Description |
|---|
ThreadPoolStage(EventHandler<T> handler,
ExecutorService executor)
Constructs a thread-pool stage.
|
ThreadPoolStage(EventHandler<T> handler,
ExecutorService executor,
EventHandler<Throwable> errorHandler)
Constructs a thread-pool stage.
|
ThreadPoolStage(EventHandler<T> handler,
int numThreads)
Constructs a thread-pool stage.
|
ThreadPoolStage(String name,
EventHandler<T> handler,
ExecutorService executor)
Constructs a thread-pool stage.
|
ThreadPoolStage(String name,
EventHandler<T> handler,
ExecutorService executor,
EventHandler<Throwable> errorHandler)
Constructs a thread-pool stage.
|
ThreadPoolStage(String name,
EventHandler<T> handler,
int numThreads)
Constructs a thread-pool stage.
|
ThreadPoolStage(String name,
EventHandler<T> handler,
int numThreads,
EventHandler<Throwable> errorHandler)
Constructs a thread-pool stage.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes resources.
|
int |
getQueueLength()
Gets the queue length of this stage.
|
void |
onNext(T value)
Handles the event using a thread in the thread pool.
|
getInMeter, getOutMeter@Inject public ThreadPoolStage(EventHandler<T> handler, int numThreads)
handler - the event handler to executenumThreads - the number of threads to useWakeRuntimeException@Inject public ThreadPoolStage(String name, EventHandler<T> handler, int numThreads, EventHandler<Throwable> errorHandler)
name - the stage namehandler - the event handler to executenumThreads - the number of threads to useerrorHandler - the error handlerWakeRuntimeException@Inject public ThreadPoolStage(String name, EventHandler<T> handler, int numThreads)
name - the stage namehandler - the event handler to executenumThreads - the number of threads to useWakeRuntimeException@Inject public ThreadPoolStage(EventHandler<T> handler, ExecutorService executor)
handler - the event handler to executeexecutor - the external executor service provided@Inject public ThreadPoolStage(EventHandler<T> handler, ExecutorService executor, EventHandler<Throwable> errorHandler)
handler - the event handler to executeexecutor - the external executor service providederrorHandler - the error handler@Inject public ThreadPoolStage(String name, EventHandler<T> handler, ExecutorService executor)
name - the stage namehandler - the event handler to executeexecutor - the external executor service provided
for consistent tracking, it is recommended to create executor with DefaultThreadFactory@Inject public ThreadPoolStage(String name, EventHandler<T> handler, ExecutorService executor, EventHandler<Throwable> errorHandler)
name - the stage namehandler - the event handler to executeexecutor - the external executor service provided
for consistent tracking, it is recommended to create executor with DefaultThreadFactoryerrorHandler - the error handlerpublic void onNext(T value)
value - the eventpublic int getQueueLength()
Copyright © 2015 The Apache Software Foundation. All rights reserved.