public final class ConsoleCommunicationImplementation extends Object implements ConsoleCommunication
Constructor and Description |
---|
ConsoleCommunicationImplementation(Resources resources,
ConsoleProperties properties,
ErrorHandler errorHandler,
TimeAuthority timeAuthority)
Constructor that uses a default idlePollDelay.
|
ConsoleCommunicationImplementation(Resources resources,
ConsoleProperties properties,
ErrorHandler errorHandler,
TimeAuthority timeAuthority,
long idlePollDelay,
long inactiveClientTimeOut)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
MessageDispatchRegistry |
getMessageDispatchRegistry()
Returns the message dispatch registry which callers can use to register new
message handlers.
|
int |
getNumberOfConnections()
The number of connections that have been accepted and are still active.
|
boolean |
processOneMessage()
Wait to receive a message, then process it.
|
void |
sendToAddressedAgents(Address address,
Message message)
Send the given message to the given agent processes (which may pass it on
to its workers).
|
void |
sendToAgents(Message message)
Send the given message to the agent processes (which may pass it on to
their workers).
|
void |
shutdown()
Shut down communication.
|
public ConsoleCommunicationImplementation(Resources resources, ConsoleProperties properties, ErrorHandler errorHandler, TimeAuthority timeAuthority) throws DisplayMessageConsoleException
resources
- Resources.properties
- Console properties.errorHandler
- Error handler.timeAuthority
- Knows the timeDisplayMessageConsoleException
- If properties are invalid.public ConsoleCommunicationImplementation(Resources resources, ConsoleProperties properties, ErrorHandler errorHandler, TimeAuthority timeAuthority, long idlePollDelay, long inactiveClientTimeOut) throws DisplayMessageConsoleException
resources
- Resources.properties
- Console properties.errorHandler
- Error handler.timeAuthority
- Knows the timeidlePollDelay
- Time in milliseconds that our ServerReceiver threads should sleep
for if there's no incoming messages.inactiveClientTimeOut
- How long before we consider a client connection that presents no
data to be inactive.DisplayMessageConsoleException
- If properties are invalid.public MessageDispatchRegistry getMessageDispatchRegistry()
getMessageDispatchRegistry
in interface ConsoleCommunication
@PreDestroy public void shutdown()
shutdown
in interface ConsoleCommunication
public boolean processOneMessage()
processOneMessage
in interface ConsoleCommunication
true
if we processed a message successfully;
false
if we've been shut down.shutdown()
public int getNumberOfConnections()
public void sendToAgents(Message message)
Any errors that occur will be handled with the error handler.
sendToAgents
in interface ConsoleCommunication
message
- The message to send.public void sendToAddressedAgents(Address address, Message message)
Any errors that occur will be handled with the error handler.
sendToAddressedAgents
in interface ConsoleCommunication
address
- The address to which the message should be sent.message
- The message to send.Copyright © 2000-2014. All Rights Reserved.