Connection Manager 3.6.3 Javadoc

org.jivesoftware.multiplexer
Class ConnectionWorkerThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.jivesoftware.multiplexer.ConnectionWorkerThread
All Implemented Interfaces:
java.lang.Runnable

public class ConnectionWorkerThread
extends java.lang.Thread

Thread that creates and keeps a connection to the server. This thread is responsable for actually forwarding clients traffic to the server. If the connection is no longer active then the thread is going to be discarded and a new one is created and added to the thread pool that is kept in ServerSurrogate.

Author:
Gaston Dombiak

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int DEFAULT_MULTIPLEX_PORT
          The default XMPP port for connection multiplex.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ConnectionWorkerThread(java.lang.ThreadGroup group, java.lang.Runnable target, java.lang.String name, long stackSize)
           
 
Method Summary
 void clientSessionClosed(java.lang.String streamID)
          Sends a notification to the main server that a client session has been closed.
 void clientSessionCreated(java.lang.String streamID, java.net.InetAddress address)
          Sends a notification to the main server that a new client session has been created.
 void deliver(java.lang.String stanza, java.lang.String streamID)
          Delivers clients traffic to the server.
 void deliveryFailed(org.dom4j.Element stanza, java.lang.String streamID)
          Sends notification to the main server that delivery of a stanza to a client has failed.
 SocketConnection getConnection()
          Returns the connection to the server.
 boolean isValid()
          Returns true if there is a connection to the server that is still active.
 void run()
           
 
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
 

Field Detail

DEFAULT_MULTIPLEX_PORT

public static final int DEFAULT_MULTIPLEX_PORT
The default XMPP port for connection multiplex.

See Also:
Constant Field Values
Constructor Detail

ConnectionWorkerThread

public ConnectionWorkerThread(java.lang.ThreadGroup group,
                              java.lang.Runnable target,
                              java.lang.String name,
                              long stackSize)
Method Detail

isValid

public boolean isValid()
Returns true if there is a connection to the server that is still active. Note that sometimes a socket assumes to be opened when in fact the underlying TCP socket connection is closed. To detect these cases we rely on heartbeats or timing out when writing data hasn't finished for a while.

Returns:
rue if there is a connection to the server that is still active.

getConnection

public SocketConnection getConnection()
Returns the connection to the server.

Returns:
the connection to the server.

clientSessionCreated

public void clientSessionCreated(java.lang.String streamID,
                                 java.net.InetAddress address)
Sends a notification to the main server that a new client session has been created.

Parameters:
streamID - the stream ID assigned by the connection manager to the new session.
address - the remote address of the client.

clientSessionClosed

public void clientSessionClosed(java.lang.String streamID)
Sends a notification to the main server that a client session has been closed.

Parameters:
streamID - the stream ID assigned by the connection manager to the closed session.

deliveryFailed

public void deliveryFailed(org.dom4j.Element stanza,
                           java.lang.String streamID)
Sends notification to the main server that delivery of a stanza to a client has failed.

Parameters:
stanza - the stanza that was not sent to the client.
streamID - the stream ID assigned by the connection manager to the no longer available session.

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

deliver

public void deliver(java.lang.String stanza,
                    java.lang.String streamID)
Delivers clients traffic to the server. The client session that originated the traffic is specified by the streamID attribute. Clients traffic is wrapped by a route element.

Parameters:
stanza - the original client stanza that is going to be wrapped.
streamID - the stream ID assigned by the connection manager to the client session.

Connection Manager 3.6.3 Javadoc

Copyright © 2003-2006 Jive Software.