|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lens.server.api.events.AsyncEventListener<T>
T
- the generic typepublic abstract class AsyncEventListener<T extends LensEvent>
Event listeners should implement this class if they wish to process events asynchronously. This should be used when event processing can block, or is computationally intensive.
Field Summary |
---|
Fields inherited from interface org.apache.lens.server.api.events.LensEventListener |
---|
HANDLER_METHOD_NAME |
Constructor Summary | |
---|---|
AsyncEventListener()
Create a single threaded event listener with an unbounded queue, with daemon threads. |
|
AsyncEventListener(int poolSize)
Create a event listener with poolSize threads with an unbounded queue and daemon threads. |
|
AsyncEventListener(int poolSize,
int maxQueueSize,
long timeOutSeconds,
boolean isDaemon)
Create an asynchronous event listener which uses a thread poool to process events. |
Method Summary | |
---|---|
BlockingQueue<Runnable> |
getEventQueue()
|
void |
onEvent(T event)
Creates a new runnable and calls the process method in it. |
abstract void |
process(T event)
Should implement the actual event handling. |
void |
stop()
Should be called to stop the event processor thread. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AsyncEventListener()
public AsyncEventListener(int poolSize)
poolSize
- the pool sizepublic AsyncEventListener(int poolSize, int maxQueueSize, long timeOutSeconds, boolean isDaemon)
poolSize
- size of the event processing poolmaxQueueSize
- max size of the event queue, if this is non positive, then the queue is unboundedtimeOutSeconds
- time out in seconds when an idle thread is destroyedisDaemon
- if the threads used to process should be daemon threads,
if false, then implementation should call stop()
to stop the thread poolMethod Detail |
---|
public void onEvent(T event) throws LensException
onEvent
in interface LensEventListener<T extends LensEvent>
event
- the event
LensException
- the lens exceptionpublic abstract void process(T event)
event
- the eventpublic void stop()
public BlockingQueue<Runnable> getEventQueue()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |