|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.exolab.core.messenger.PacketConnection
A PacketConnection is a Connection that minimises resource usage.
This is achieved by:
Channel instances
ConnectionEventListener,
PacketChannel,
PacketQueue,
PacketPool,
Multiplexer,
Demultiplexer| Constructor Summary | |
PacketConnection(ManagedPacketConnection owner,
int connectionId)
Construct a new PacketConnection |
|
| Method Summary | |
void |
accept(java.lang.String name,
ChannelHandler handler)
Register a handler to accept channel connections for the specified name. |
void |
accept(java.lang.String name,
ChannelListener listener)
Register a handler to accept a single channel connection for the specified name, and bind the listener to it This method returns immediately. |
void |
addConnectionEventListener(ConnectionEventListener listener)
Add a listener for connection events |
void |
close()
Close the connection. |
void |
close(java.lang.String name)
Stop accepting requests on the specified channel |
protected void |
closed(PacketChannel channel)
|
protected PacketChannel |
createChannel(int channelId,
int destinationId)
|
protected void |
doClose()
Performs the actual connection closure, without notifying registered listeners |
protected void |
ensureOpen()
|
protected Channel |
getChannel(int channelId)
Returns the channel for the give channel identifier |
int |
getConnectionId()
Return the unique identifier for this connection |
protected int |
getNextChannelId()
|
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 |
Channel |
open(java.lang.String name)
Open a channel |
void |
removeConnectionEventListener(ConnectionEventListener listener)
Remove a listener of connection events |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PacketConnection(ManagedPacketConnection owner,
int connectionId)
throws java.rmi.RemoteException
PacketConnection
owner - the managed connection that owns thisconnectionId - the connection identifier
java.lang.IllegalArgumentException - if owner is null
java.rmi.RemoteException - if the connection can't be initialised| Method Detail |
public int getConnectionId()
public Channel open(java.lang.String name)
throws java.rmi.RemoteException
open in interface Connectionname - the name of the channel
java.rmi.RemoteException - if the channel can't be opened
ConnectionClosedException - if the connection is closed
InvalidChannelException - if the channel doesn't exist
public void accept(java.lang.String name,
ChannelHandler handler)
throws java.rmi.RemoteException
accept in interface Connectionname - the channel name to listen onhandler - the handler to pass new channels to
java.rmi.RemoteException - if an error occurs accepting channels
ConnectionClosedException - if the connection is closed
java.lang.IllegalArgumentException - if any argument is null
public void accept(java.lang.String name,
ChannelListener listener)
throws java.rmi.RemoteException
accept in interface Connectionname - the channel name to listen onlistener - the listener to handle requests on the channel
java.rmi.RemoteException - if an error occurs accepting channels
ConnectionClosedException - if the connection is closed
java.lang.IllegalArgumentException - if any argument is nullpublic void close(java.lang.String name)
close in interface Connectionname - the channel name
java.lang.IllegalArgumentException - if name is nullpublic void addConnectionEventListener(ConnectionEventListener listener)
addConnectionEventListener in interface Connectionlistener - the listener to addpublic void removeConnectionEventListener(ConnectionEventListener listener)
removeConnectionEventListener in interface Connectionlistener - the listener to remove
public void close()
throws java.rmi.RemoteException
This closes all channels open on the connection, and then closes the
underlying physical connection, prior to notifying
registered ConnectionEventListener instances
close in interface Connectionjava.rmi.RemoteException - if an error occurs closing the connection
protected void doClose()
throws java.rmi.RemoteException
java.rmi.RemoteException - if an error occurs closing the connectionprotected Channel getChannel(int channelId)
channelId - the channel identifier
protected PacketQueue getOutputQueue()
protected org.exolab.core.messenger.PacketPool getPool()
protected ThreadPool getThreadPool()
protected PacketChannel createChannel(int channelId,
int destinationId)
throws java.rmi.RemoteException
java.rmi.RemoteException
protected void closed(PacketChannel channel)
throws java.rmi.RemoteException
java.rmi.RemoteExceptionprotected int getNextChannelId()
protected void ensureOpen()
throws java.rmi.RemoteException
java.rmi.RemoteException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||