public final class ConsoleListener extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ANY
Constant that represent any message.
|
static int |
RESET
Constant that represents a a reset message.
|
static int |
SHUTDOWN
Constant that represents a communication shutdown.
|
static int |
START
Constant that represents start message.
|
static int |
STOP
Constant that represents a stop message.
|
Constructor and Description |
---|
ConsoleListener(Condition notifyOnMessage,
org.slf4j.Logger logger)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkForMessage(int mask)
Check for messages matching the given mask.
|
void |
discardMessages(int mask)
Discard pending messages that match the given mask.
|
StartGrinderMessage |
getLastStartGrinderMessage()
Return the last
StartGrinderMessage received. |
boolean |
received(int mask)
Query the messages set up by the last
checkForMessage(int) or
waitForMessage() call. |
void |
registerMessageHandlers(MessageDispatchRegistry messageDispatcher)
Registers message handlers with a dispatcher.
|
void |
shutdown()
Shut down.
|
void |
waitForMessage()
Wait until any message is received.
|
public static final int START
received(int)
,
Constant Field Valuespublic static final int RESET
received(int)
,
Constant Field Valuespublic static final int STOP
received(int)
,
Constant Field Valuespublic static final int SHUTDOWN
received(int)
,
Constant Field Valuespublic static final int ANY
received(int)
,
Constant Field Valuespublic ConsoleListener(Condition notifyOnMessage, org.slf4j.Logger logger)
notifyOnMessage
- An Object
to notify when a message arrives.logger
- A @ code Logger} to which received event messages are loggged.public void shutdown()
public void waitForMessage()
After calling this method, the actual messages can be
determined using received(int)
.
public boolean checkForMessage(int mask)
After calling this method, the actual messages can be
determined using received(int)
.
mask
- The messages to check for.true
if at least one message matches the
mask
parameter has been received since the last time
the message was checked for, or if communications have been
shutdown. false
otherwise.public void discardMessages(int mask)
mask
- The messages to discard.public boolean received(int mask)
checkForMessage(int)
or
waitForMessage()
call.mask
- The messages to check for.true
if one or more of the received
messages matches mask
.public void registerMessageHandlers(MessageDispatchRegistry messageDispatcher)
messageDispatcher
- The dispatcher.public StartGrinderMessage getLastStartGrinderMessage()
StartGrinderMessage
received.Copyright © 2000-2014. All Rights Reserved.