org.edg.info
Class Messenger

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.edg.info.Messenger
All Implemented Interfaces:
java.lang.Runnable

public abstract class Messenger
extends java.lang.Thread

Messages that can't fail can be send by implementations of this. Clients call sendMessage(). Subclasses implement tryToSendMessage(), and should not remove the message from messages unless the message was sent, or if certain exceptions are thrown.


Field Summary
static int ERROR
          Result code indicating that message failed and should be retried.
static int FATAL
          Result code indicating that message failed and should be removed from list.
static int FIREWALL
          Result code indicating that a firewall caused the message to fail, so the message and all messages to the same host should be removed from the list.
static int OK
          Result code indicating that message was sent successfully so can be removed from list.
static int READ_TIMEOUT
          Result code indicating that the read time-out was reached.
static java.lang.String[] RESULT_CODES
          String representations of result codes.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 void flushQueue(java.lang.String queueName, java.lang.String host)
           
 Message getCopyOfCurrentMessageInQueue()
           
 Message[] getCopyOfMessageQueue()
           
 java.lang.Object[] getMessages()
          DOCUMENT ME!
 long getNotifyInterval()
          DOCUMENT ME!
 Messenger getSlowQueue()
          DOCUMENT ME!
 void run()
          Main thread loop.
 void setRootMessenger(Messenger rootMessenger)
          DOCUMENT ME!
 void startAll()
          Starts this thread and all "slower" messengers that it uses.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OK

public static final int OK
Result code indicating that message was sent successfully so can be removed from list.

See Also:
Constant Field Values

ERROR

public static final int ERROR
Result code indicating that message failed and should be retried.

See Also:
Constant Field Values

FATAL

public static final int FATAL
Result code indicating that message failed and should be removed from list.

See Also:
Constant Field Values

FIREWALL

public static final int FIREWALL
Result code indicating that a firewall caused the message to fail, so the message and all messages to the same host should be removed from the list.

See Also:
Constant Field Values

READ_TIMEOUT

public static final int READ_TIMEOUT
Result code indicating that the read time-out was reached.

See Also:
Constant Field Values

RESULT_CODES

public static final java.lang.String[] RESULT_CODES
String representations of result codes.

Method Detail

setRootMessenger

public void setRootMessenger(Messenger rootMessenger)
DOCUMENT ME!

Parameters:
rootMessenger - DOCUMENT ME!

startAll

public void startAll()
Starts this thread and all "slower" messengers that it uses.


run

public void run()
Main thread loop.


getCopyOfMessageQueue

public Message[] getCopyOfMessageQueue()
Returns:
A copy of the messenger's fast message queue.

getMessages

public java.lang.Object[] getMessages()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getCopyOfCurrentMessageInQueue

public Message getCopyOfCurrentMessageInQueue()
Returns:
A copy of the current message being sent from the fast queue. Returns null if no message exists.

flushQueue

public void flushQueue(java.lang.String queueName,
                       java.lang.String host)
Parameters:
queueName -
host -

getSlowQueue

public Messenger getSlowQueue()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getNotifyInterval

public long getNotifyInterval()
DOCUMENT ME!

Returns:
DOCUMENT ME!