org.exolab.core.messenger
Interface Connection

All Known Implementing Classes:
PacketConnection

public interface Connection

A Connection represents a logical connection over a shared physical connection, managed by a ManagedConnection

Version:
$Revision: 1.4 $ $Date: 2002/02/21 09:49:41 $
Author:
Tim Anderson
See Also:
Channel, ChannelHandler, ManagedConnection

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
 Channel open(java.lang.String name)
          Open a channel
 void removeConnectionEventListener(ConnectionEventListener listener)
          Remove a listener of connection events
 

Method Detail

open

Channel open(java.lang.String name)
             throws java.rmi.RemoteException
Open a channel

Parameters:
name - the name of the channel
Returns:
the open channel
Throws:
java.rmi.RemoteException - if the channel can't be opened
InvalidChannelException - if the channel doesn't exist

accept

void accept(java.lang.String name,
            ChannelHandler handler)
            throws java.rmi.RemoteException
Register a handler to accept channel connections for the specified name.
This method returns immediately.

Parameters:
name - the channel name to listen on
handler - the handler to pass new channels to
Throws:
java.rmi.RemoteException - if an error occurs accepting channels
java.lang.IllegalArgumentException - if any argument is null

accept

void accept(java.lang.String name,
            ChannelListener listener)
            throws java.rmi.RemoteException
Register a handler to accept a single channel connection for the specified name, and bind the listener to it
This method returns immediately.

Parameters:
name - the channel name to listen on
listener - the listener to handle requests on the channel
Throws:
java.rmi.RemoteException - if an error occurs accepting channels
java.lang.IllegalArgumentException - if any argument is null

close

void close(java.lang.String name)
Stop accepting requests on the specified channel

Parameters:
name - the channel name
Throws:
java.lang.IllegalArgumentException - if name is null

close

void close()
           throws java.rmi.RemoteException
Close the connection

This closes all channels open on the connection, prior to notifying registered ConnectionEventListener instances

Throws:
java.rmi.RemoteException - if an error occurs closing the connection

addConnectionEventListener

void addConnectionEventListener(ConnectionEventListener listener)
Add a listener for connection events

Parameters:
listener - the listener to add

removeConnectionEventListener

void removeConnectionEventListener(ConnectionEventListener listener)
Remove a listener of connection events

Parameters:
listener - the listener to remove


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