|
||||||||||
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
public abstract class BusStrategy
A bus strategy for handling messages. Subclasses must implement their
strategy within the handle(Message)
method.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected AbstractBus |
bus
|
protected ModuleContext |
busModule
|
protected CommunicationModule |
commModule
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
protected |
BusStrategy(CommunicationModule commModule)
Constructor receiving the CommunicationModule instance and
creating queue for the messages. |
protected |
BusStrategy(CommunicationModule commModule,
String name)
Constructor receiving the CommunicationModule instance and
creating queue for the messages. |
Method Summary | |
---|---|
protected ChannelMessage |
buildChannelMessage(BusMessage m)
|
protected BusMember |
getBusMember(String memberID)
Returns bus member instance based on the bus member ID. |
protected AbstractBus |
getLocalBusByName(String name)
Returns bus based on the passed bus name. |
protected abstract void |
handle(BusMessage m,
String senderID)
Handle the message. |
void |
handleMessage(BusMessage m,
String senderID)
This method handles the message asynchronously, while trying to preserve the order of the messages from the same source, according to the counters of the messages. |
void |
run()
Runs BusStrategy. |
protected void |
send(BusMessage message)
|
void |
setBus(AbstractBus bus)
Joins the bus and the BusStrategy. |
void |
stopThread()
Stops BusStrategy Thread. |
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 |
Field Detail |
---|
protected AbstractBus bus
protected ModuleContext busModule
protected CommunicationModule commModule
Constructor Detail |
---|
protected BusStrategy(CommunicationModule commModule)
CommunicationModule
instance and
creating queue for the messages.
commModule
- CommunicationModule
instanceprotected BusStrategy(CommunicationModule commModule, String name)
CommunicationModule
instance and
creating queue for the messages.
commModule
- CommunicationModule
instancename
- Human-readable name of the Bus StrategyMethod Detail |
---|
protected BusMember getBusMember(String memberID)
memberID
- bus member ID
protected abstract void handle(BusMessage m, String senderID)
m
- messagesenderID
- sender (bus member) IDprotected AbstractBus getLocalBusByName(String name)
name
- bus name
public final void handleMessage(BusMessage m, String senderID)
m
- message to be handledsenderID
- sender IDpublic final void run()
run
in interface Runnable
run
in class Thread
public void setBus(AbstractBus bus)
bus
- buspublic final void stopThread()
protected ChannelMessage buildChannelMessage(BusMessage m)
protected void send(BusMessage message)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |