|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.core.messenger.ManagedPacketConnection
public class ManagedPacketConnection
A ManagedPacketConnection
implements an efficient packet
based protocol over a low level transport protocol.
PacketConnection
,
Messenger
Nested Class Summary | |
---|---|
static class |
ManagedPacketConnection.ConnectRequest
|
static class |
ManagedPacketConnection.ConnectResponse
|
Constructor Summary | |
---|---|
ManagedPacketConnection(Context context,
MultiplexerFactory factory)
Construct a new ManagedPacketConnection |
Method Summary | |
---|---|
void |
accept(java.lang.String name,
ConnectionHandler handler)
Register a handler to accept new connections. This method returns immediately. |
void |
close()
Destroys the physical connection, prior to notifying any registered ManagedConnectionEventListener instance |
void |
close(java.lang.String name)
Stop accepting connect requests for the specified connection |
void |
closed(Connection connection)
Invoked when a connection is closed |
protected PacketConnection |
createConnection(java.lang.String name)
Create a new connection to serve a client |
protected void |
doClose()
Performs the actual connection closure, without notifying registered listeners |
protected void |
ensureOpen()
|
void |
error(Connection connection,
java.lang.Exception exception)
Invoked when a fatal connection error occurs, just before an Exception is thrown to the application |
protected void |
errorOnStream(java.lang.Exception reason)
Handle an error event, raised by the Multiplexer or Demultiplexer. |
protected Channel |
getChannel(int connectionId,
int channelId)
Helper to return a channel for a particular connection |
protected PacketQueue |
getOutputQueue()
Returns the queue of packets to be streamed down the physical connection |
protected org.exolab.core.messenger.PacketPool |
getPool()
Returns the pool of free packets |
protected ThreadPool |
getThreadPool()
Returns the thread pool |
protected void |
initialise()
Initialises the connection |
Connection |
open(java.lang.String name,
ConnectionProperties properties)
Creates a new connection handle for the underlying physical connection represented by the ManagedConnection instance |
void |
setManagedConnectionEventListener(ManagedConnectionEventListener listener)
Set the listener for connection events |
protected void |
streamClosed()
Handle a close event, raised by the Multiplexer or Demultiplexer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ManagedPacketConnection(Context context, MultiplexerFactory factory)
ManagedPacketConnection
context
- the connection contextfactory
- the factory for multiplexers/demultiplexers
java.lang.IllegalArgumentException
- if any argument is nullMethod Detail |
---|
public Connection open(java.lang.String name, ConnectionProperties properties) throws java.rmi.RemoteException
open
in interface ManagedConnection
name
- the name of the connectionproperties
- connection properties (may be null)
ConnectException
- if no handler is registered for
name
java.rmi.RemoteException
- if a new connection handle cannot be createdpublic void accept(java.lang.String name, ConnectionHandler handler) throws java.rmi.RemoteException
accept
in interface ManagedConnection
handler
- the handler to pass new connections toname
- the connection name to listen on
java.rmi.RemoteException
- if an error occurs registering the handler
java.lang.IllegalArgumentException
- if any argument is nullpublic void close(java.lang.String name)
close
in interface ManagedConnection
name
- the connection name
java.lang.IllegalArgumentException
- if name
is nullpublic void close() throws java.rmi.RemoteException
ManagedConnectionEventListener
instance
close
in interface ManagedConnection
java.rmi.RemoteException
- if an error occurs closing the connectionpublic void setManagedConnectionEventListener(ManagedConnectionEventListener listener)
setManagedConnectionEventListener
in interface ManagedConnection
listener
- the event listener. Setting it to null
removes the listenerpublic void closed(Connection connection)
closed
in interface ConnectionEventListener
connection
- the closed connectionpublic void error(Connection connection, java.lang.Exception exception)
error
in interface ConnectionEventListener
connection
- the connection the error occurred onexception
- the errorprotected Channel getChannel(int connectionId, int channelId)
connectionId
- the connection identifierchannelId
- the channel identifier
protected void initialise() throws java.rmi.RemoteException
java.rmi.RemoteException
- if the connection can't be initialisedprotected void doClose() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurs closing the connectionprotected PacketQueue getOutputQueue()
protected org.exolab.core.messenger.PacketPool getPool()
protected ThreadPool getThreadPool()
protected PacketConnection createConnection(java.lang.String name) throws java.rmi.RemoteException
name
- the connection name
java.rmi.RemoteException
- if the connection cannot be created
java.lang.IllegalArgumentException
- if name
is nullprotected void ensureOpen() throws java.rmi.RemoteException
java.rmi.RemoteException
protected void streamClosed()
protected void errorOnStream(java.lang.Exception reason)
connection
- this connectionreason
- the exception describing the cause
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |