
public abstract class BusStrategy extends Thread
handle(Message) method.Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description |
|---|---|
protected AbstractBus |
bus |
protected ModuleContext |
busModule |
protected CommunicationModule |
commModule |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Modifier | Constructor and Description |
|---|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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, yieldprotected AbstractBus bus
protected ModuleContext busModule
protected CommunicationModule commModule
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 Strategyprotected BusMember getBusMember(String memberID)
memberID - bus member IDprotected abstract void handle(BusMessage m, String senderID)
m - messagesenderID - sender (bus member) IDprotected AbstractBus getLocalBusByName(String name)
name - bus namepublic final void handleMessage(BusMessage m, String senderID)
m - message to be handledsenderID - sender IDpublic final void run()
public void setBus(AbstractBus bus)
bus - buspublic final void stopThread()
protected ChannelMessage buildChannelMessage(BusMessage m)
protected void send(BusMessage message)
Copyright © 2018 universAAL Consortium. All rights reserved.