|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jicarilla.framework.AbstractActive
org.jicarilla.framework.AbstractExecutable
org.jicarilla.framework.AbstractAsyncEnabled
A basic AsyncEnabled implementation that inherits actual thread
handling to the AbstractActive class. Any calls to
handle(Invocation) are queued, with the work() method
(implementing the 'interface' exposed by AbstractExecutable)
dequeuing an invocation and sending it to
doHandle(Invocation).
To create concrete AsyncEnabled classes based on this
abstract class, there's usually little you will want or need to do. Likely
entry points for customization include the getImmediateResult(Invocation)
method (which is called from handle()), the
doHandle() method (if you wish to redirect the handling of the
asynchronous calls somewhere else) and the
doHandleException(Invocation) method (if you wish to handle
exceptions thrown from applying Invocations gracefully).
| Nested Class Summary |
| Nested classes inherited from class org.jicarilla.framework.AbstractExecutable |
AbstractExecutable.Worker |
| Field Summary | |
protected Channel |
m_incoming
The recipient of incoming calls. |
| Fields inherited from class org.jicarilla.framework.AbstractExecutable |
m_executor, m_listener, m_worker |
| Fields inherited from class org.jicarilla.framework.AbstractActive |
m_running, m_stopped |
| Constructor Summary | |
AbstractAsyncEnabled(Executor executor)
Create an instance using a custom executor. |
|
AbstractAsyncEnabled(Executor executor,
ExceptionListener listener)
Create an instance using a custom executor and an exception listener. |
|
| Method Summary | |
protected void |
doHandle(Invocation invocation)
This method will be called from the worker thread and you should implement whatever behaviour neccessary to complete the invocation. |
protected void |
doHandleException(Invocation invocation)
This method is called by the default doHandle() implementation if an exception occurs making the invocation. |
protected java.lang.Object |
getImmediateResult(Invocation invocation)
Override this to specify what the handle() method should return after enqueuing an invocation. |
java.lang.Object |
handle(Invocation invocation)
Enqueue the invocation on the asynchronous call stack. |
protected void |
work()
Implements the superclass method by dequeuing an
invocation (possibly blocking until one is added to the queue), then
feeding it to the doHandle(Invocation) method. |
| Methods inherited from class org.jicarilla.framework.AbstractExecutable |
doDispose, doInitialize |
| Methods inherited from class org.jicarilla.framework.AbstractActive |
checkActive, dispose, initialize, isActive, isDisposed, isInitialized, lazyInitialization |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final Channel m_incoming
| Constructor Detail |
public AbstractAsyncEnabled(Executor executor)
executor - the Executor that will be used in
AbstractExecutable to do the work
public AbstractAsyncEnabled(Executor executor,
ExceptionListener listener)
executor - the Executor that will be used in
AbstractExecutable to do the worklistener - the listener that will be notified of any abnomral
problems occuring during the calls to work(). Note that
any exceptions resulting from applying an Invocation
are not sent to this listener.| Method Detail |
public java.lang.Object handle(Invocation invocation)
throws java.lang.InterruptedException
handle in interface AsyncEnabledinvocation - the invocation to enqueue
getImmediateResult(Invocation) returns
java.lang.InterruptedException - if the current thread has been
Thread.interrupt()edprotected java.lang.Object getImmediateResult(Invocation invocation)
null.
invocation - the invocation that has just been enqueued
protected void doHandle(Invocation invocation)
invocation - the invocation that has just been dequeued and should
now be applied or redirected somewhere elseprotected void doHandleException(Invocation invocation)
invocation - the invocation that was applied and caused an
exception
protected void work()
throws java.lang.InterruptedException,
java.lang.Throwable
superclass method by dequeuing an
invocation (possibly blocking until one is added to the queue), then
feeding it to the doHandle(Invocation) method.
work in class AbstractExecutablejava.lang.InterruptedException - if the current thread has been
Thread.interrupt()ed
java.lang.Throwable - if any problem occurs. The exception will be fed to
any exceptionlisteners that may exist.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||