|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.net.MessageDelegator
public class MessageDelegator
MessageDelegator listens for incoming messages on the given
connection and delegates the message to the handler - once its
run() method is called.
The MessageDelegator will listen continuously until
stopListening() is called or an IOException is caught.
ConnectionDispatcher,
NetConnection,
NetConnectionHandler| Field Summary |
|---|
| Fields inherited from interface com.antelmann.util.Enabled |
|---|
FILTER |
| Constructor Summary | |
|---|---|
MessageDelegator(NetConnection con,
NetConnectionHandler handler)
|
|
MessageDelegator(NetConnection con,
NetConnectionHandler handler,
Logger logger)
if logger is not null, it will be used to log established and closed connections |
|
| Method Summary | |
|---|---|
NetConnection |
getConnection()
|
boolean |
getContinuousMode()
if false, the run() method will exit after a single message was received |
NetConnectionHandler |
getHandler()
|
Logger |
getLogger()
|
int |
getMessageCount()
|
int |
getMissedMessages()
returns the number of messages that were missed due to a ClassNotFoundException (unknown messages) |
boolean |
isEnabled()
determines whether this object is currently enabled |
void |
resetMessageCount()
|
void |
run()
run() listens for incoming messages and delegates to the handler. |
void |
setEnabled(boolean enabled)
allows to enable/disable this instance |
void |
setLogger(Logger logger)
|
void |
stopListening()
disables the listener and causes run() to exit after either the next message is read or an IOException is thrown; it does not close the connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MessageDelegator(NetConnection con,
NetConnectionHandler handler)
public MessageDelegator(NetConnection con,
NetConnectionHandler handler,
Logger logger)
| Method Detail |
|---|
public NetConnection getConnection()
public NetConnectionHandler getHandler()
public Logger getLogger()
public void setLogger(Logger logger)
public void stopListening()
getConnection().close().
public boolean isEnabled()
Enabled
isEnabled in interface Enabledpublic void setEnabled(boolean enabled)
Enabled
setEnabled in interface Enabledpublic int getMessageCount()
public void resetMessageCount()
public boolean getContinuousMode()
public void run()
run in interface RunnableLogger,
LogWriter,
Levelpublic int getMissedMessages()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||