|
||||||||||
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
org.universAAL.middleware.ui.impl.generic.CoordinatedStrategy
public class CoordinatedStrategy
Strategy stack dedicated only to manage Coordination of the bus.
This strategy consists of 3 basic events:
AALSpaceManager
to listen to
lost peers
, in case they are the coordinator;
or if the Coordinator has left the coordinated space, it automatically surrenders coordination.
Also new Peers
joining the space will proactively be informed about who is the coordinator.
Nested Class Summary | |
---|---|
static class |
CoordinatedStrategy.CoordinatorAlreadyExistsException
Exception indicating there is already a Coordinator. |
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static String |
TYPE_uAAL_UI_BUS_COORDINATOR_BROADCAST
|
static String |
TYPE_uAAL_UI_BUS_COORDINATOR_REQUEST
|
static String |
TYPE_uAAL_UI_BUS_COORDINATOR_RESIGN
|
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 | |
---|---|
CoordinatedStrategy(CommunicationModule commModule)
|
|
CoordinatedStrategy(CommunicationModule commModule,
String name)
|
Method Summary | |
---|---|
void |
aalSpaceJoined(AALSpaceDescriptor spaceDescriptor)
|
void |
aalSpaceLost(AALSpaceDescriptor spaceDescriptor)
|
void |
aalSpaceStatusChanged(AALSpaceStatus status)
|
void |
close()
Tearing down |
PeerCard |
getCoordinator()
|
protected boolean |
iAmCoordinator()
|
protected void |
lostCoordinator()
Extending classes may override this method to perform any opertation needed when the coordinator is lost. |
void |
newPeerJoined(PeerCard peer)
|
void |
peerLost(PeerCard peer)
|
protected void |
requestBecomeACoordinator()
Check the conditions and announce this Peer as coordinator. |
protected void |
resignFromCoordinator()
Check and announce this Peer is no longer the coordinator. |
void |
sharedObjectAdded(Object sharedObj,
Object removeHook)
|
void |
sharedObjectRemoved(Object removeHook)
|
void |
start()
|
Methods inherited from class org.universAAL.middleware.ui.impl.generic.CallBasedStrategy |
---|
abortAll, abortCall, handle, placeAsynchronousRequest, placeAsynchronousRequest, placeSynchronousRequest, placeSynchronousRequest, sendAsynchronousResponse, sendAsynchronousResponse, sendSynchronousResponse |
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, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String TYPE_uAAL_UI_BUS_COORDINATOR_BROADCAST
public static final String TYPE_uAAL_UI_BUS_COORDINATOR_REQUEST
public static final String TYPE_uAAL_UI_BUS_COORDINATOR_RESIGN
Constructor Detail |
---|
public CoordinatedStrategy(CommunicationModule commModule)
commModule
- public CoordinatedStrategy(CommunicationModule commModule, String name)
commModule
- name
- Method Detail |
---|
protected void lostCoordinator()
public void start()
start
in class Thread
protected final boolean iAmCoordinator()
protected final void requestBecomeACoordinator() throws CoordinatedStrategy.CoordinatorAlreadyExistsException
CoordinatedStrategy.CoordinatorAlreadyExistsException
protected final void resignFromCoordinator() throws CoordinatedStrategy.CoordinatorAlreadyExistsException
CoordinatedStrategy.CoordinatorAlreadyExistsException
- in case this peer is not the coordinator.public final PeerCard getCoordinator()
public void aalSpaceJoined(AALSpaceDescriptor spaceDescriptor)
aalSpaceJoined
in interface AALSpaceListener
spaceDescriptor
- Space descepublic void aalSpaceLost(AALSpaceDescriptor spaceDescriptor)
aalSpaceLost
in interface AALSpaceListener
spaceDescriptor
- Space descepublic void newPeerJoined(PeerCard peer)
newPeerJoined
in interface AALSpaceListener
peer
- PeerCardpublic void peerLost(PeerCard peer)
peerLost
in interface AALSpaceListener
public void aalSpaceStatusChanged(AALSpaceStatus status)
aalSpaceStatusChanged
in interface AALSpaceListener
public void sharedObjectAdded(Object sharedObj, Object removeHook)
sharedObjectAdded
in interface SharedObjectListener
public void sharedObjectRemoved(Object removeHook)
sharedObjectRemoved
in interface SharedObjectListener
public void close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |