public class CoordinatedStrategy extends CallBasedStrategy implements AALSpaceListener, SharedObjectListener
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.Modifier and Type | Class and Description |
---|---|
static class |
CoordinatedStrategy.CoordinatorAlreadyExistsException
Exception indicating there is already a Coordinator.
|
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
static String |
TYPE_uAAL_UI_BUS_COORDINATOR_BROADCAST |
static String |
TYPE_uAAL_UI_BUS_COORDINATOR_REQUEST |
static String |
TYPE_uAAL_UI_BUS_COORDINATOR_RESIGN |
bus, busModule, commModule
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
CoordinatedStrategy(CommunicationModule commModule) |
CoordinatedStrategy(CommunicationModule commModule,
String name) |
Modifier and Type | Method and Description |
---|---|
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() |
abortAll, abortCall, handle, placeAsynchronousRequest, placeAsynchronousRequest, placeSynchronousRequest, placeSynchronousRequest, sendAsynchronousResponse, sendAsynchronousResponse, sendSynchronousResponse
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, stop, stop, suspend, toString, yield
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
public CoordinatedStrategy(CommunicationModule commModule)
commModule
- public CoordinatedStrategy(CommunicationModule commModule, String name)
commModule
- name
- protected void lostCoordinator()
protected final boolean iAmCoordinator()
protected final void requestBecomeACoordinator() throws 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()
Copyright © 2015 universAAL Consortium. All Rights Reserved.