public abstract class SingleRequestInitiator extends Object implements Behavior, Protocol
This is a special request initiator that communicates with exactly one receiver. There are special results and call-back methods for all types of errors.
This abstract implementation is particularly intended to be extended by other implementations.
Modifier and Type | Field and Description |
---|---|
static Result |
FAILURE_EXCEPTION |
static Result |
NOT_UNDERSTOOD_EXCEPTION |
static Result |
REFUSE_EXCEPTION |
static Result |
REPLY_NOT_UNDERSTOOD_EXCEPTION |
Modifier and Type | Method and Description |
---|---|
ProtocolIdentifier |
getIdentifier()
Returns the identifier of this identifiable object.
|
void |
handleFailure(String message)
Callback method in order to handle a
failure message
received from the responder. |
void |
handleNotUnderstood(String message)
Callback method in order to handle a
not-understood message
received from the responder. |
void |
handleRefuse(String message)
Callback method in order to handle a
refuse message received
from the responder. |
boolean |
isFinished()
Indicates whether the behavior is finished or requires re-scheduling.
|
Result |
result()
Returns the result of the behavior.
|
void |
run()
The implementation of the actual behavior.
|
EventPattern |
waitingFor()
Defines the event pattern for re-scheduling.
|
public static final Result NOT_UNDERSTOOD_EXCEPTION
public static final Result FAILURE_EXCEPTION
public static final Result REFUSE_EXCEPTION
public static final Result REPLY_NOT_UNDERSTOOD_EXCEPTION
public ProtocolIdentifier getIdentifier()
Identifiable
getIdentifier
in interface Identifiable<ProtocolIdentifier>
public void handleNotUnderstood(String message)
not-understood
message
received from the responder. The default implementation is empty.message
- the error description sent by the responderpublic void handleFailure(String message)
failure
message
received from the responder. The default implementation is empty.message
- the error description sent by the responderpublic void handleRefuse(String message)
refuse
message received
from the responder. The default implementation is empty.message
- the error description sent by the responderpublic EventPattern waitingFor()
Behavior
waitingFor
in interface Behavior
null
if the behavior is finishedpublic void run()
Behavior
public boolean isFinished()
Behavior
isFinished
in interface Behavior
true
if the behavior is finished,
false
otherwiseCopyright © Aimpulse Intelligent Systems GmbH
All rights reserved.