|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.jscience.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. The
MessageDelegator can be used as a Runnable for the
createHandlerThread()
in ConnectionDispatcher.
ConnectionDispatcher#createHandlerThread(NetConnectioncon)
,
NetConnection
,
NetConnectionHandler
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
MessageDelegator(NetConnection con,
NetConnectionHandler handler)
Creates a new MessageDelegator object. |
|
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()
DOCUMENT ME! |
boolean |
getContinuousMode()
if false, the run() method will exit after a single message was received |
NetConnectionHandler |
getHandler()
DOCUMENT ME! |
Logger |
getLogger()
DOCUMENT ME! |
int |
getMessageCount()
DOCUMENT ME! |
int |
getMissedMessages()
returns the number of messages that were missed due to a ClassNotFoundException (unknown messages) |
void |
resetMessageCount()
DOCUMENT ME! |
void |
run()
run() listens for incoming messages and delegates to the handler. |
void |
setLogger(Logger logger)
DOCUMENT ME! |
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.Thread |
---|
activeCount, checkAccess, 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, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MessageDelegator(NetConnection con, NetConnectionHandler handler)
con
- DOCUMENT ME!handler
- DOCUMENT ME!public MessageDelegator(NetConnection con, NetConnectionHandler handler, Logger logger)
Method Detail |
---|
public NetConnection getConnection()
public NetConnectionHandler getHandler()
public Logger getLogger()
public void setLogger(Logger logger)
logger
- DOCUMENT ME!public void stopListening()
public int getMessageCount()
public void resetMessageCount()
public boolean getContinuousMode()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
Logger
,
LogWriter
,
Level
public int getMissedMessages()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |