public class DefaultReality extends AbstractParticipant implements IReality
IParticipant.State
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACK_TIMEOUT_PARAM |
static java.lang.String |
DISCONNECT_PARAM |
static java.lang.String |
MESSAGE_TTL
Deprecated.
|
Constructor and Description |
---|
DefaultReality() |
Modifier and Type | Method and Description |
---|---|
void |
add(ICredentials credentials,
boolean wantsClockControl) |
void |
cleanUp()
disconnect and shutdown
|
void |
configure(java.util.Map<java.lang.String,java.lang.String> options)
configure the participant.
|
protected java.util.concurrent.ExecutorService |
createIOExecutorService()
return a cached thread pool executor so that each connection will be
processed by its own thread.
|
protected org.apache.mina.core.service.IoHandler |
createIOHandler(IIdentifier.Type type) |
IAddressingInformation |
getAddressingInformation() |
java.util.concurrent.Executor |
getCentralExector() |
MasterClock |
getClock()
return the clock that this participant has access to
|
ICredentials |
getCredentials() |
java.lang.String |
getName() |
protected StateAndConnectionManager |
getStateAndConnectionManager() |
long |
getTimeout() |
void |
initialize()
initialize common reality.
|
IIdentifier |
newIdentifier(IIdentifier owner,
IIdentifier template) |
void |
remove(ICredentials credentials) |
void |
reset(boolean clockWillBeReset)
called when we are to reset to a post-initialize state.
|
void |
resume()
resume a suspended participant and return state to started.
|
java.util.concurrent.Future<IAcknowledgement> |
send(IIdentifier identifier,
IMessage message)
send a message to a specific participant.
|
java.util.concurrent.Future<IAcknowledgement> |
send(IMessage message)
this will actually send to EVERYONE connected - and returns a null
acknowldgement for now..
|
protected java.util.concurrent.Future<IAcknowledgement> |
send(org.apache.mina.core.session.IoSession session,
IMessage message) |
java.util.concurrent.Future<IAcknowledgement> |
send(java.lang.Object session,
IMessage message) |
protected boolean |
setParticipantStates(IParticipant.State state)
set the state of the connected participants.
|
void |
setTimeout(long timeout) |
void |
shutdown()
tell folks to shut down..
|
void |
start()
tell all the participants to start
|
void |
stop()
called when this participant needs to stop
|
void |
suspend()
suspend the participant if it is started.
|
addClientService, addServerService, checkState, clearObjectManagers, connect, createAfferentObjectManager, createAgentObjectManager, createEfferentCommandManager, createEfferentObjectManager, createNotificationManager, createRealObjectManager, createSensorObjectManager, disconnect, disconnect, getAfferentObjectManager, getAgentObjectManager, getCentralThreadFactory, getCommonRealityIdentifier, getEfferentCommandManager, getEfferentObjectManager, getIdentifier, getIOExecutor, getIOHandler, getIOThreadFactory, getNotificationManager, getPeriodicExecutor, getRealObjectManager, getSensorObjectManager, getServerAddressInformation, getState, setClock, setCommonRealityIdentifier, setIdentifier, shutdown, stateMatches, waitForState, waitForState
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connect, disconnect, disconnect, getAfferentObjectManager, getAgentObjectManager, getEfferentCommandManager, getEfferentObjectManager, getNotificationManager, getRealObjectManager, getSensorObjectManager, getState, shutdown, stateMatches, waitForState, waitForState
getIdentifier
@Deprecated public static final java.lang.String MESSAGE_TTL
public static final java.lang.String ACK_TIMEOUT_PARAM
public static final java.lang.String DISCONNECT_PARAM
protected java.util.concurrent.ExecutorService createIOExecutorService()
createIOExecutorService
in class AbstractParticipant
protected StateAndConnectionManager getStateAndConnectionManager()
protected org.apache.mina.core.service.IoHandler createIOHandler(IIdentifier.Type type)
createIOHandler
in class AbstractParticipant
public java.util.concurrent.Executor getCentralExector()
public long getTimeout()
public void setTimeout(long timeout)
public java.lang.String getName()
getName
in class AbstractParticipant
public MasterClock getClock()
AbstractParticipant
getClock
in interface IParticipant
getClock
in interface IReality
getClock
in class AbstractParticipant
public void initialize() throws java.lang.Exception
initialize
in interface IParticipant
initialize
in class AbstractParticipant
java.lang.Exception
AbstractParticipant.initialize()
public void configure(java.util.Map<java.lang.String,java.lang.String> options) throws java.lang.Exception
IParticipant
configure
in interface IParticipant
configure
in class AbstractParticipant
java.lang.Exception
public void cleanUp()
protected boolean setParticipantStates(IParticipant.State state)
state
- public void reset(boolean clockWillBeReset) throws java.lang.Exception
AbstractParticipant
reset
in interface IParticipant
reset
in class AbstractParticipant
java.lang.Exception
org.commonreality.participant.impl.AbstractParticipant#reset()
public void start() throws java.lang.Exception
start
in interface IParticipant
start
in class AbstractParticipant
java.lang.Exception
AbstractParticipant.start()
public void stop() throws java.lang.Exception
AbstractParticipant
stop
in interface IParticipant
stop
in class AbstractParticipant
java.lang.Exception
AbstractParticipant.stop()
public java.util.concurrent.Future<IAcknowledgement> send(IMessage message)
send
in interface IParticipant
send
in class AbstractParticipant
AbstractParticipant.send(org.commonreality.message.IMessage)
public java.util.concurrent.Future<IAcknowledgement> send(java.lang.Object session, IMessage message)
protected java.util.concurrent.Future<IAcknowledgement> send(org.apache.mina.core.session.IoSession session, IMessage message)
public java.util.concurrent.Future<IAcknowledgement> send(IIdentifier identifier, IMessage message)
IReality
IIdentifier.ALL
by sending the message to all participantspublic void resume() throws java.lang.Exception
IParticipant
resume
in interface IParticipant
resume
in class AbstractParticipant
java.lang.Exception
AbstractParticipant.resume()
public void shutdown() throws java.lang.Exception
shutdown
in interface IParticipant
shutdown
in class AbstractParticipant
java.lang.Exception
AbstractParticipant.shutdown()
public void suspend() throws java.lang.Exception
IParticipant
suspend
in interface IParticipant
suspend
in class AbstractParticipant
java.lang.Exception
AbstractParticipant.suspend()
public IAddressingInformation getAddressingInformation()
getAddressingInformation
in class AbstractParticipant
AbstractParticipant.getAddressingInformation()
public ICredentials getCredentials()
getCredentials
in class AbstractParticipant
AbstractParticipant.getCredentials()
public IIdentifier newIdentifier(IIdentifier owner, IIdentifier template)
newIdentifier
in interface IReality
org.commonreality.reality.IReality#newIdentifier(org.commonreality.participant.identifier.IParticipantIdentifier,
java.lang.String)
public void add(ICredentials credentials, boolean wantsClockControl)
public void remove(ICredentials credentials)
remove
in interface IReality
IReality.remove(org.commonreality.message.credentials.ICredentials)