protected abstract class AbstractRemoteInvocationCaller.AbstractRemoteInvocationQueue extends Object implements RemoteInvocationQueue
RemoteInvocationQueue
.Modifier and Type | Field and Description |
---|---|
private boolean |
autoCommit |
private List<RemoteInvocationCallData<?,CALL>> |
callQueue |
private AbstractRemoteInvocationCaller.AbstractRemoteInvocationQueue |
childQueue |
private AbstractRemoteInvocationCaller.AbstractRemoteInvocationQueue |
parentQueue |
private Consumer<Throwable> |
queueFailureCallback |
private RemoteInvocationQueueSettings |
settings |
private RemoteInvocationQueueState |
state |
private List<AbstractRemoteInvocationCaller.AbstractRemoteInvocationQueue> |
subQueues |
Constructor and Description |
---|
AbstractRemoteInvocationQueue(RemoteInvocationQueueSettings settings)
The constructor.
|
AbstractRemoteInvocationQueue(RemoteInvocationQueueSettings settings,
AbstractRemoteInvocationCaller.AbstractRemoteInvocationQueue parentQueue)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addCall(RemoteInvocationCallData<?,CALL> callData)
This method adds the given
RemoteInvocationCallData to this queue. |
void |
cancel()
This method cancels this queue.
|
private void |
close()
This method closes this queue.
|
(package private) boolean |
collectCalls(AbstractRemoteInvocationCaller.RequestBuilder requestBuilder,
boolean hasOpenTransaction)
This method collects the
GenericRemoteInvocationTransactionalCalls for this queue recursively. |
void |
commit()
This method completes this queue.
|
List<RemoteInvocationCallData<?,CALL>> |
getCallQueue() |
Consumer<Throwable> |
getDefaultFailureCallback()
This method gets the default callback to
handle failures that occurred on
service invocations. |
String |
getId()
This method gets the ID used to identify this object.
|
protected String |
getIdInfo() |
AbstractRemoteInvocationCaller.AbstractRemoteInvocationQueue |
getParentQueue() |
RemoteInvocationQueueSettings |
getSettings() |
RemoteInvocationQueueState |
getState()
This method gets the
RemoteInvocationQueueState of this queue. |
protected void |
requireNoChildQueue()
Internal method to ensure that this queue is the current active queue and no child-queue has been
opened and not completed.
|
protected void |
requireNoCurrentCall()
Internal method to ensure that no current call is pending.
|
protected void |
requireOpen()
Internal method to ensure this queue is still
open . |
void |
setDefaultFailureCallback(Consumer<Throwable> failureCallback)
This method sets the
default failure callback . |
private final RemoteInvocationQueueSettings settings
getSettings()
private AbstractRemoteInvocationCaller.AbstractRemoteInvocationQueue parentQueue
getParentQueue()
private List<AbstractRemoteInvocationCaller.AbstractRemoteInvocationQueue> subQueues
getCallQueue()
private List<RemoteInvocationCallData<?,CALL extends RemoteInvocationCall>> callQueue
getCallQueue()
private Consumer<Throwable> queueFailureCallback
getDefaultFailureCallback()
private RemoteInvocationQueueState state
getState()
private AbstractRemoteInvocationCaller.AbstractRemoteInvocationQueue childQueue
getParentQueue()
private boolean autoCommit
addCall(RemoteInvocationCallData)
public AbstractRemoteInvocationQueue(RemoteInvocationQueueSettings settings)
settings
- - see getSettings()
.public AbstractRemoteInvocationQueue(RemoteInvocationQueueSettings settings, AbstractRemoteInvocationCaller.AbstractRemoteInvocationQueue parentQueue)
settings
- - see getSettings()
.parentQueue
- - see getParentQueue()
.boolean collectCalls(AbstractRemoteInvocationCaller.RequestBuilder requestBuilder, boolean hasOpenTransaction)
GenericRemoteInvocationTransactionalCalls
for this queue recursively.requestBuilder
- is the AbstractRemoteInvocationCaller.RequestBuilder
.hasOpenTransaction
- - true
if a
transaction has already been
opened
, false
otherwise.true
if a transaction is currently open
, false
otherwise.public void setDefaultFailureCallback(Consumer<Throwable> failureCallback)
default failure callback
.setDefaultFailureCallback
in interface AttributeWriteDefaultFailureCallback
failureCallback
- is the new value of AttributeReadDefaultFailureCallback.getDefaultFailureCallback()
.public Consumer<Throwable> getDefaultFailureCallback()
RemoteInvocationQueue
handle
failures that occurred on
service invocations.
It will be used as fallback if no failure callback is specified explicitly. Queues
will inherit the default failure callback from their parent. A toplevel queue inherits from the
invocation caller
.getDefaultFailureCallback
in interface AttributeReadDefaultFailureCallback
getDefaultFailureCallback
in interface RemoteInvocationQueue
default failure-callback
.public List<RemoteInvocationCallData<?,CALL>> getCallQueue()
protected void addCall(RemoteInvocationCallData<?,CALL> callData)
RemoteInvocationCallData
to this queue.callData
- is the RemoteInvocationCallData
to add.public RemoteInvocationQueueSettings getSettings()
RemoteInvocationQueueSettings
given when this queue has been
created
.public String getId()
getId
in interface RemoteInvocationQueue
getId
in interface AttributeReadId<String>
RemoteInvocationCaller.newQueue(String)
protected String getIdInfo()
ID
or the empty string if
not present.public AbstractRemoteInvocationCaller.AbstractRemoteInvocationQueue getParentQueue()
public RemoteInvocationQueueState getState()
RemoteInvocationQueueState
of this queue. The
RemoteInvocationQueueState
of a
new queue
is initially
RemoteInvocationQueueState.OPEN
. After RemoteInvocationQueue.commit()
is called the status turns to
RemoteInvocationQueueState.COMITTED
. After RemoteInvocationQueue.cancel()
is called it turns to
RemoteInvocationQueueState.CANCELLED
. As soon as the status is closed (NOT
RemoteInvocationQueueState.OPEN
), it can NOT be opened anymore and further adding of service
invocations to the queue will fail.getState
in interface RemoteInvocationQueue
RemoteInvocationQueueState
of this queue.protected void requireOpen()
open
.protected void requireNoCurrentCall()
protected void requireNoChildQueue()
public void commit()
RemoteInvocationQueue.commit()
. Otherwise, if this is a sub-queue (a queue
created
while another queue was
already open
), the collected invocations will be
appended to the parent queue. closing
the queue.
Therefore it is totally legal to open a queue in your generic infrastructure by default then perform some
sort of initialization that may or may not cause service invocations on that queue and finally commit the
queue.commit
in interface RemoteInvocationQueue
private void close()
public void cancel()
cancel
in interface RemoteInvocationQueue
Copyright © 2001–2016 mmm-Team. All rights reserved.