public class BACIDispatchAction extends java.lang.Object implements PrioritizedRunnable
| Modifier and Type | Class and Description |
|---|---|
static interface |
BACIDispatchAction.DispatchFailedListener
Dispatch failed listener interface.
|
class |
BACIDispatchAction.DispatchRequest
Class containing request data.
|
| Modifier and Type | Field and Description |
|---|---|
protected Callback |
callback
Callback.
|
protected CallbackDispatcher |
callbackDispatcher
Callback dispatcher (used to dispatch non-CBvoid callbacks).
|
protected static int |
DEFAULT_FAILURE_COUNT_LIMIT
Failure limit.
|
protected CBDescOut |
descOut
Callback out descriptor.
|
protected int |
failureCount
Failure count.
|
protected int |
failureCountLimit
Failure limit (number of retries), 0 means until successfull.
|
protected java.util.ArrayList<BACIDispatchAction.DispatchFailedListener> |
listeners
List of registered listeners.
|
protected boolean |
overridePolicy
Override policy for request queue.
|
protected BACIDispatchAction.DispatchRequest |
pendingRequest
Pending request.
|
protected BACIPriority |
priority
Action priority.
|
protected java.util.LinkedList |
queue
Ordered dispatch queue.
|
protected boolean |
submitPending
Flag indicating pending submit.
|
| Constructor and Description |
|---|
BACIDispatchAction(Callback callback,
CBDescIn descIn,
CallbackDispatcher callbackDispatcher)
Constructor of NORMAL priority action.
|
BACIDispatchAction(Callback callback,
CBDescIn descIn,
CallbackDispatcher callbackDispatcher,
BACIPriority priority)
Constructor.
|
BACIDispatchAction(CBvoid callback,
CBDescIn descIn)
Constructor of NORMAL priority action (CBvoid callback).
|
BACIDispatchAction(CBvoid callback,
CBDescIn descIn,
BACIPriority priority)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDispatchFailedListener(BACIDispatchAction.DispatchFailedListener listener)
Add dispatch failed listener.
|
protected boolean |
dispatch()
Dispatch method.
|
void |
dispatchDoneRequest(Completion completion)
Added done callback request to dispatch queue.
|
void |
dispatchDoneRequest(Completion completion,
java.lang.Object value)
Added done callback request to dispatch queue.
|
protected void |
dispatchRequest(BACIDispatchAction.DispatchRequest request)
Added request to dispatch queue (internal).
|
void |
dispatchRequest(int type,
Completion completion,
java.lang.Object value)
Added request to dispatch queue.
|
void |
dispatchWorkingRequest(Completion completion)
Added working callback request to dispatch queue.
|
void |
dispatchWorkingRequest(Completion completion,
java.lang.Object value)
Added working callback request to dispatch queue.
|
protected boolean |
failed()
Call this metod to notify dispatch failure.
|
protected static CBDescOut |
generateCBDescOut(CBDescIn descIn)
Generates callback out descriptor from in descriptor.
|
CBDescOut |
getDescOut()
Get callback out-descriptor.
|
BACIPriority |
getPriority()
Return priority of the task.
|
boolean |
isOverridePolicy()
Get current override policy.
|
void |
removeDispatchFailedListener(BACIDispatchAction.DispatchFailedListener listener)
Remove dispatch failed listener.
|
void |
run()
NOT TO BE CHANGED.
|
void |
setOverridePolicy(boolean b)
Set current override policy.
|
void |
setPriority(BACIPriority priority)
Set dispatching priority.
|
protected void |
submit()
Sumbit action to be
BACIExecutor |
protected BACIPriority priority
protected CBDescOut descOut
protected Callback callback
protected CallbackDispatcher callbackDispatcher
protected static final int DEFAULT_FAILURE_COUNT_LIMIT
protected int failureCountLimit
protected int failureCount
protected java.util.LinkedList queue
protected BACIDispatchAction.DispatchRequest pendingRequest
queue's monitor.protected boolean submitPending
queue's monitor.protected boolean overridePolicy
true newer request will override request in the queue.
If false (default) requests will form a linked list.protected java.util.ArrayList<BACIDispatchAction.DispatchFailedListener> listeners
public BACIDispatchAction(CBvoid callback,
CBDescIn descIn)
callback - action callback.descIn - action callback in descriptor.public BACIDispatchAction(Callback callback,
CBDescIn descIn,
CallbackDispatcher callbackDispatcher)
callback - action callback.descIn - action callback in descriptor.callbackDispatcher - callback dispatcher (value dependend).public BACIDispatchAction(CBvoid callback,
CBDescIn descIn,
BACIPriority priority)
callback - action callback.descIn - action in descriptor.priority - action priority.public BACIDispatchAction(Callback callback,
CBDescIn descIn,
CallbackDispatcher callbackDispatcher,
BACIPriority priority)
callback - action callback.descIn - action in descriptor.callbackDispatcher - callback dispatcher (value dependend).priority - action priority.public void dispatchWorkingRequest(Completion completion)
completion - completion.value - value.public void dispatchWorkingRequest(Completion completion,
java.lang.Object value)
completion - completion.public void dispatchDoneRequest(Completion completion)
completion - completion.public void dispatchDoneRequest(Completion completion,
java.lang.Object value)
completion - completion.value - value.public void dispatchRequest(int type,
Completion completion,
java.lang.Object value)
protected void dispatchRequest(BACIDispatchAction.DispatchRequest request)
public BACIPriority getPriority()
PrioritizedRunnablegetPriority in interface PrioritizedRunnablePrioritizedRunnable.getPriority()protected static CBDescOut generateCBDescOut(CBDescIn descIn)
descIn - callback in descriptor.public final void run()
run in interface java.lang.Runnableprotected boolean failed()
true, if dispaching is to be canceled (e.g. failure counter reached its failure limit)protected boolean dispatch()
pendingRequest, should be non-null.true if successfully dispatched.protected void submit()
BACIExecutor to be executed.public CBDescOut getDescOut()
public boolean isOverridePolicy()
public void setOverridePolicy(boolean b)
b - override policy to set.public void setPriority(BACIPriority priority)
priority - dispatching priority to set.public void addDispatchFailedListener(BACIDispatchAction.DispatchFailedListener listener)
listener - listener to listen failed dispatch notifications.public void removeDispatchFailedListener(BACIDispatchAction.DispatchFailedListener listener)
listener - listener to remove.