org.iids.aos.kernel.mux
Class BaseConnection

java.lang.Object
  extended by org.iids.aos.kernel.mux.BaseConnection
Direct Known Subclasses:
LoopbackBaseConnection

public class BaseConnection
extends java.lang.Object

A base connection between this and another multiplexer. Performs several functions. A base connection encapsulates the underlying socket that carries the communication. Any number of virtual connections may be multiplexed on top of a base connection. As per the protocol spec, all messages related to a particular virtual connection (and therefore a connection port) must be carried by the same base connection. Also as per the protocol spec, a virtual connection will not try to replace a closed base connection with another one. Instead, such a virtual connection is closed. For this purpose, a base connection keeps a set of 'dependent connection ports'. A dependent connection port is a connection port whose communication is carried by the base connection. This way, when the base connection is closed, we can determine which connection ports are affected. Thread-safe.

Author:
Patrick Verkaik

Constructor Summary
BaseConnection(java.net.Socket socket)
          Special case: used by ACTP to send MUXP_OPEN_ERROR_USE_SEPARATE_BASECONN
 
Method Summary
 void close()
          Performs the actions that must occur to fully close the base connection and remove any associated state.
 void close(java.io.IOException e)
           
 KernelException getExceptionThatCausedClose()
           
 java.net.Socket getSocket()
          Returns the underlying socket.
 boolean inUse()
          When errors occur on a base connection we call this method to see if it affected any MUXP connections.
 boolean isClosed()
          Returns true iff close() has been called.
 java.lang.String localName()
          Returns a human-readable string for the local communication endpoint.
 java.lang.String remoteName()
          Returns some human-readable string for the remote multiplexer.
 void setExceptionThatCausedClose(KernelException e)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseConnection

public BaseConnection(java.net.Socket socket)
Special case: used by ACTP to send MUXP_OPEN_ERROR_USE_SEPARATE_BASECONN

Method Detail

getSocket

public java.net.Socket getSocket()
Returns the underlying socket.


close

public void close()
Performs the actions that must occur to fully close the base connection and remove any associated state. This includes cleaning up RemoteMux and ConnectionPort state, and closing the underlying socket. Any further calls to addDependentConnectionPort() are disabled. This call renders the base connection and socket unusable so that further operations will receive an error.


close

public void close(java.io.IOException e)

inUse

public boolean inUse()
When errors occur on a base connection we call this method to see if it affected any MUXP connections.


isClosed

public boolean isClosed()
Returns true iff close() has been called.


setExceptionThatCausedClose

public void setExceptionThatCausedClose(KernelException e)

getExceptionThatCausedClose

public KernelException getExceptionThatCausedClose()

localName

public java.lang.String localName()
Returns a human-readable string for the local communication endpoint.


remoteName

public java.lang.String remoteName()
Returns some human-readable string for the remote multiplexer.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2003, 2004 IIDS Group. All Rights Reserved.