org.exolab.core.mipc
Class MultiplexSSLConnection

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.exolab.core.mipc.MultiplexConnection
          extended byorg.exolab.core.mipc.MultiplexSSLConnection
All Implemented Interfaces:
MultiplexConnectionIfc, java.lang.Runnable

public class MultiplexSSLConnection
extends MultiplexConnection

The MultiplexSSLConnection encapsulates a single network connection. It allows for multiple channels or multiplexed message streams. The object is thread-safe and uses threads within it to do its job. The design for the Multiplexed streaming borrows concepts from the book "Java Network Programming : A Complete Guide to Networking, Streams, and Distributed Computing", by Merlin Hughes, Michael Shoffner, Derek Hamner The MultiplexConnection is designed as follows: - users of the connection register themselves as channels. each channel is given a stream to place outbound messages on, and gives the MC a stream to write inbound messages on. Typically this "inbound" stream is a Queue Stream and the user sucks messages off of the queue on a separate thread. That way the multiplex delivery mechanism does not have to wait for a channel handler to process a message. - As channel producers send messages, they are multiplexed and placed on a queue for outbound delivery. A separate MessageCopier thread takes messages from this queue and sends them onto to the "raw" outbound stream. - Inbound messages are handled by Demultiplixer. The Demux manages a list of channels. It unwraps a packet and uses the name encoded in the packet to pass the message onto an output stream. This outputstream is the one passed into "register" by the channel consumer/producer. The Demux runs within the same thread as MultiplexConnection. It is important to note: All activity on the "raw" inbound and outbound streams are synchronized, as well as the objects used to build the MultiplexConnection. So everything is thread-safe.

Version:
$Revision: 1.5 $
Author:
Jim Mourikis
See Also:
MultiplexConnectionServer, MessageCopier, Demultiplexer

Field Summary
 
Fields inherited from class org.exolab.core.mipc.MultiplexConnection
_finished
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MultiplexSSLConnection(javax.net.ssl.SSLSocket socket)
          Creates a MultiplexSSLConnection on top of an existing Socket
MultiplexSSLConnection(java.lang.String host, int port)
          Creates new MultiplexSSLConnection on the specified host and port.
MultiplexSSLConnection(java.lang.ThreadGroup group, javax.net.ssl.SSLSocket socket)
          Creates a MultiplexSSLConnection on top of an existing Socket
 
Methods inherited from class org.exolab.core.mipc.MultiplexConnection
deregister, disconnected, finish, getHost, getPort, init, register, run, setDisconnectionEventListener
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiplexSSLConnection

public MultiplexSSLConnection(java.lang.String host,
                              int port)
                       throws java.io.IOException
Creates new MultiplexSSLConnection on the specified host and port.

Parameters:
host - the host name to create a socket connection to
port - the port to connect to

MultiplexSSLConnection

public MultiplexSSLConnection(javax.net.ssl.SSLSocket socket)
                       throws java.io.IOException
Creates a MultiplexSSLConnection on top of an existing Socket

Parameters:
socket - The existing socket to wrap.

MultiplexSSLConnection

public MultiplexSSLConnection(java.lang.ThreadGroup group,
                              javax.net.ssl.SSLSocket socket)
                       throws java.io.IOException
Creates a MultiplexSSLConnection on top of an existing Socket

Parameters:
group - the thread group that the connection belongs to
socket - the existing socket to wrap


Copyright © 1999-2005 The Exolab Group. All Rights Reserved.