Voyager ORB

com.objectspace.voyager.transport
Interface ITransportConnection


public abstract interface ITransportConnection

The ITransportConnection interface can be implemented in conjuction with the ITransportServer interface to allow a Voyager server to accept and initiate network communications over a specific transport protocol, such as tcp or udp.


Method Summary
 boolean allowsConcurrentUse()
          Tests to see if this connection instance allows concurrent use.
 void becomeServer()
          Forces this connection to spawn a thread and begin processing incoming requests.
Typically an ITransportServer implementation will accept an incoming socket/connection and construct an instance of an ITransportConnection to manage it.
 void close()
          Closes this connection.
 ITransportConnection duplicate()
          Returns a new connection instance connected to the same remote host as this instance.
 java.lang.String getLocalXURL()
          Returns a String representing the local host address.
 ITransportServer getServer()
          Returns the ITransportServer that created this connection.
 java.lang.String getURL()
          Returns a String representing the remote host the connection is bound to.
 boolean isLocked()
          Tests if this connection instance is locked by another thread without blocking.
 boolean isOpen()
          Tests if this connection instance is still 'connected' to a remote host.
 boolean isServer()
          Tests if this connection instance has become a server and is processing incoming messages.
 ITransportConnection lock()
          Allows the calling object to acquire a lock on this connection.
 java.io.InputStream lockInput()
          Allows the calling object to acquire a lock on the InputStream before returning it.
 java.io.OutputStream lockOutput()
          Allows the calling object to acquire a lock on the OutputStream before returning it.
 void release()
          Allows the calling object to release a previously acquired lock on this connection.
 void releaseInput()
          Allows the calling object to release its lock on the InputStream given by this connection instance.
 void releaseInputTo(java.lang.Thread thread)
          Allows the calling object to transfer its lock to the given thread.
 void releaseOutput()
          Allows the calling object to release its lock on the OutputStream given by this connection instance.
 void releaseOutputTo(java.lang.Thread thread)
          Allows the calling object to transfer its lock to the given thread.
 void reset()
          Allows for the connection to be reinitialized.
 void setConcurrentUse(boolean allow)
          Notifies this connection that it will be shared among multiple references.
 

Method Detail

getLocalXURL

public java.lang.String getLocalXURL()
Returns a String representing the local host address.

getURL

public java.lang.String getURL()
Returns a String representing the remote host the connection is bound to.

getServer

public ITransportServer getServer()
Returns the ITransportServer that created this connection.

setConcurrentUse

public void setConcurrentUse(boolean allow)
Notifies this connection that it will be shared among multiple references.

lock

public ITransportConnection lock()
                          throws java.io.IOException
Allows the calling object to acquire a lock on this connection. This method should block until the current lock is freed.
Returns:
This instance of ITransportConnection.
Throws:
java.io.IOException - Thrown if a lock cannot be established.

release

public void release()
Allows the calling object to release a previously acquired lock on this connection.

lockOutput

public java.io.OutputStream lockOutput()
                                throws java.io.IOException
Allows the calling object to acquire a lock on the OutputStream before returning it.
Throws:
java.io.IOException - Thrown if a lock cannot be established.

releaseInput

public void releaseInput()
Allows the calling object to release its lock on the InputStream given by this connection instance.

releaseInputTo

public void releaseInputTo(java.lang.Thread thread)
Allows the calling object to transfer its lock to the given thread.

lockInput

public java.io.InputStream lockInput()
                              throws java.io.IOException
Allows the calling object to acquire a lock on the InputStream before returning it.
Throws:
java.io.IOException - Thrown if a lock cannot be established.

releaseOutput

public void releaseOutput()
Allows the calling object to release its lock on the OutputStream given by this connection instance.

releaseOutputTo

public void releaseOutputTo(java.lang.Thread thread)
Allows the calling object to transfer its lock to the given thread.

close

public void close()
Closes this connection.

reset

public void reset()
Allows for the connection to be reinitialized.

duplicate

public ITransportConnection duplicate()
                               throws java.io.IOException
Returns a new connection instance connected to the same remote host as this instance.
Throws:
java.io.IOException - Thrown if a new connection cannot be created.

becomeServer

public void becomeServer()
Forces this connection to spawn a thread and begin processing incoming requests.
Typically an ITransportServer implementation will accept an incoming socket/connection and construct an instance of an ITransportConnection to manage it. This method would be called allowing the connection to begin processing the incoming data.

isLocked

public boolean isLocked()
Tests if this connection instance is locked by another thread without blocking.

isOpen

public boolean isOpen()
Tests if this connection instance is still 'connected' to a remote host.

isServer

public boolean isServer()
Tests if this connection instance has become a server and is processing incoming messages.

allowsConcurrentUse

public boolean allowsConcurrentUse()
Tests to see if this connection instance allows concurrent use.

ObjectSpace Inc.

(c) Copyright 1997-1999 ObjectSpace, Inc.
14850 Quorum Drive, Suite 500
Dallas, Texas 75240