
public class CoordinatedStrategy extends CallBasedStrategy implements SpaceListener, SharedObjectListener
SpaceManager 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_UI_BUS_COORDINATOR_BROADCAST |
static String |
TYPE_UI_BUS_COORDINATOR_REQUEST |
static String |
TYPE_UI_BUS_COORDINATOR_RESIGN |
bus, busModule, commModuleMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
CoordinatedStrategy(CommunicationModule commModule) |
CoordinatedStrategy(CommunicationModule commModule,
String name) |
| Modifier and Type | Method and Description |
|---|---|
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 |
peerJoined(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 |
spaceJoined(SpaceDescriptor spaceDescriptor) |
void |
spaceLost(SpaceDescriptor spaceDescriptor) |
void |
spaceStatusChanged(SpaceStatus status) |
void |
start() |
abortAll, abortCall, handle, placeAsynchronousRequest, placeAsynchronousRequest, placeSynchronousRequest, placeSynchronousRequest, sendAsynchronousResponse, sendAsynchronousResponse, sendSynchronousResponsesendEventToRemoteBusMember, sendEventToRemoteBusMember, sendEventToRemoteBusMember, sendEventToRemoteBusMember, sendEventToRemoteBusMemberbuildChannelMessage, getBusMember, getLocalBusByName, handleMessage, run, send, setBus, stopThreadactiveCount, 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, yieldpublic static final String TYPE_UI_BUS_COORDINATOR_BROADCAST
public static final String TYPE_UI_BUS_COORDINATOR_REQUEST
public static final String TYPE_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 spaceJoined(SpaceDescriptor spaceDescriptor)
spaceJoined in interface SpaceListenerspaceDescriptor - Space descepublic void spaceLost(SpaceDescriptor spaceDescriptor)
spaceLost in interface SpaceListenerspaceDescriptor - Space descriptorpublic void peerJoined(PeerCard peer)
peerJoined in interface SpaceListenerpeer - PeerCardpublic void peerLost(PeerCard peer)
peerLost in interface SpaceListenerpublic void spaceStatusChanged(SpaceStatus status)
spaceStatusChanged in interface SpaceListenerpublic void sharedObjectAdded(Object sharedObj, Object removeHook)
sharedObjectAdded in interface SharedObjectListenerpublic void sharedObjectRemoved(Object removeHook)
sharedObjectRemoved in interface SharedObjectListenerpublic void close()
Copyright © 2018 universAAL Consortium. All rights reserved.