|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.universAAL.middleware.bus.model.BusStrategy
org.universAAL.middleware.ui.impl.generic.EventBasedStrategy
org.universAAL.middleware.ui.impl.generic.CallBasedStrategy
public class CallBasedStrategy
A set of methods to place calls and responses, both for synchronous and asynchronous calls.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class org.universAAL.middleware.bus.model.BusStrategy |
---|
bus, busModule, commModule |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
CallBasedStrategy(CommunicationModule commModule)
|
|
CallBasedStrategy(CommunicationModule commModule,
String name)
|
Method Summary | |
---|---|
void |
abortAll()
Abort all pending calls, |
void |
abortCall(String msgId)
Abort the call with the given ID. it unblocks the call and the CallSynchronizer#performCall(Object, Object) will throw a
InterruptedException . |
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. |
Methods inherited from class org.universAAL.middleware.ui.impl.generic.EventBasedStrategy |
---|
sendEventToRemoteBusMember, sendEventToRemoteBusMember, sendEventToRemoteBusMember, sendEventToRemoteBusMember, sendEventToRemoteBusMember |
Methods inherited from class org.universAAL.middleware.bus.model.BusStrategy |
---|
buildChannelMessage, getBusMember, getLocalBusByName, handleMessage, run, send, setBus, stopThread |
Methods inherited from class java.lang.Thread |
---|
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 |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CallBasedStrategy(CommunicationModule commModule, String name)
commModule
- name
- public CallBasedStrategy(CommunicationModule commModule)
commModule
- Method Detail |
---|
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |