public class CallBasedStrategy extends EventBasedStrategy
Thread.State, Thread.UncaughtExceptionHandler
bus, busModule, commModule
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
CallBasedStrategy(CommunicationModule commModule) |
CallBasedStrategy(CommunicationModule commModule,
String name) |
Modifier and Type | Method and Description |
---|---|
void |
abortAll()
Abort all pending calls,
|
void |
abortCall(String msgId)
Abort the call with the given ID.
|
protected void |
handle(BusMessage m,
String senderID) |
protected void |
placeAsynchronousRequest(PeerCard peer,
CallMessage<? extends CallBasedStrategy> callMessage)
Send an asynchronous request to memberID.
|
protected void |
placeAsynchronousRequest(String memberID,
CallMessage<? extends CallBasedStrategy> callMessage)
Send an asynchronous request to memberID.
|
protected Object |
placeSynchronousRequest(PeerCard peer,
CallMessage<? extends CallBasedStrategy> callMessage)
Place a Synchronous request, The
CallMessage is sent and the
message is anotated as waiting for response, the calling thread will be
set in a waiting state until either a response to the message is
received, or the call is aborted . |
protected Object |
placeSynchronousRequest(String memberID,
CallMessage<? extends CallBasedStrategy> callMessage)
Place a Synchronous request, The
CallMessage is sent and the
message is anotated as waiting for response, the calling thread will be
set in a waiting state until either a response to the message is
received, or the call is aborted . |
void |
sendAsynchronousResponse(PeerCard peer,
CallMessage<? extends CallBasedStrategy> response) |
void |
sendAsynchronousResponse(String memberID,
CallMessage<? extends CallBasedStrategy> response) |
void |
sendSynchronousResponse(BusMessage original,
Object resp)
For use of
CallMessage subclasses to send a response to the call. |
sendEventToRemoteBusMember, sendEventToRemoteBusMember, sendEventToRemoteBusMember, sendEventToRemoteBusMember, sendEventToRemoteBusMember
buildChannelMessage, getBusMember, getLocalBusByName, handleMessage, run, send, setBus, stopThread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public CallBasedStrategy(CommunicationModule commModule, String name)
commModule
- name
- public CallBasedStrategy(CommunicationModule commModule)
commModule
- protected void handle(BusMessage m, String senderID)
handle
in class EventBasedStrategy
m
- messagesenderID
- sender (bus member) IDprotected Object placeSynchronousRequest(String memberID, CallMessage<? extends CallBasedStrategy> callMessage) throws InterruptedException
CallMessage
is sent and the
message is anotated as waiting for response, the calling thread will be
set in a waiting state until either a response to the message is
received, or the call is aborted
.memberID
- The recipient of the requestcallMessage
- The Message to send.InterruptedException
- if the call was aborted.protected void placeAsynchronousRequest(String memberID, CallMessage<? extends CallBasedStrategy> callMessage)
EventMessage
or a
CallMessage
the
onResponse
will have to manage.memberID
- callMessage
- protected Object placeSynchronousRequest(PeerCard peer, CallMessage<? extends CallBasedStrategy> callMessage) throws InterruptedException
CallMessage
is sent and the
message is anotated as waiting for response, the calling thread will be
set in a waiting state until either a response to the message is
received, or the call is aborted
.memberID
- The recipient of the requestcallMessage
- The Message to send.InterruptedException
- if the call was aborted.protected void placeAsynchronousRequest(PeerCard peer, CallMessage<? extends CallBasedStrategy> callMessage)
EventMessage
or a
CallMessage
the
onResponse
will have to manage.memberID
- callMessage
- public void abortCall(String msgId)
CallSynchronizer#performCall(Object, Object)
will throw a
InterruptedException
.msgId
- the messageId of the call that should be aborted.public void abortAll()
public void sendSynchronousResponse(BusMessage original, Object resp)
CallMessage
subclasses to send a response to the call.original
- resp
- public void sendAsynchronousResponse(PeerCard peer, CallMessage<? extends CallBasedStrategy> response)
public void sendAsynchronousResponse(String memberID, CallMessage<? extends CallBasedStrategy> response)
Copyright © 2018 universAAL Consortium. All rights reserved.