org.apache.geronimo.remoting.transport.async
Class ChannelPool

java.lang.Object
  extended byorg.apache.geronimo.remoting.transport.async.ChannelPool
All Implemented Interfaces:
Router

public class ChannelPool
extends Object
implements Router

a ChannelPool represents a logical connection to a remote uri. - It handles decomposing synchronous requests into async requests. - It pools AsychChannel connections to be able concurrently do multiple asyc sends.

Version:
$Revision: 1.3 $ $Date: 2004/03/10 09:59:20 $

Constructor Summary
ChannelPool(URI uri, Router dispatcher)
           
 
Method Summary
 void associate(Channel c)
          Associate a channel to the pool.
 void dispatchDatagram(URI to, Msg data, ChannelPool source)
          A ChannelPool will receive data from a Channel and if it is new request, it will forward it to the AsynchChannelServer for it to dispatch the work the appropriate subsystem.
 void dispatchRequest(URI to, AsyncMsg data, ChannelPool source)
          A ChannelPool will receive data from a Channel and if it is new request, it will forward it to the AsynchChannelServer for it to dispatch the work the appropriate subsystem.
 void dispose()
           
 void expireIdleConnections(long connectionTimeout)
          Expires idle connections
 URI getBackConnectURI()
           
 int getCreatedChannelCount()
           
 org.apache.geronimo.remoting.transport.async.ChannelPool.PooledAsynchChannel getNextAvailable()
          Return the next available AsynchChannel object for a given invocation session.
 void sendDatagram(URI to, Msg data)
          Sends a datagram message.
 Msg sendRequest(URI to, Msg data)
          Sends a request message to the other end.
 void sendResponse(Msg data, int requestId)
           
 void setBackConnectURI(URI backConnectURI)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelPool

public ChannelPool(URI uri,
                   Router dispatcher)
Parameters:
uri -
Method Detail

dispose

public void dispose()

associate

public void associate(Channel c)
               throws TransportException
Associate a channel to the pool. When a AsynchChannelServer accepts a new channel it will associate the existing AsynchChannel with the pool. TODO: Add some logic to age out old idle connections.

Throws:
TransportException

expireIdleConnections

public void expireIdleConnections(long connectionTimeout)
Expires idle connections

Returns:

getNextAvailable

public org.apache.geronimo.remoting.transport.async.ChannelPool.PooledAsynchChannel getNextAvailable()
                                                                                              throws TransportException
Return the next available AsynchChannel object for a given invocation session. It will automatically allocate a new AsynchChannel if none are available.

Returns:
Throws:
RemotingException
TransportException

dispatchDatagram

public void dispatchDatagram(URI to,
                             Msg data,
                             ChannelPool source)
A ChannelPool will receive data from a Channel and if it is new request, it will forward it to the AsynchChannelServer for it to dispatch the work the appropriate subsystem. This a datagram that does not require a response message to be sent back.

Parameters:
data -
source - - the channel pool that the datagram came over.

dispatchRequest

public void dispatchRequest(URI to,
                            AsyncMsg data,
                            ChannelPool source)
A ChannelPool will receive data from a Channel and if it is new request, it will forward it to the AsynchChannelServer for it to dispatch the work the appropriate subsystem. This a request and requires a response message to be sent back.

Parameters:
data -
source - - the channel pool that the request came over.

sendDatagram

public void sendDatagram(URI to,
                         Msg data)
                  throws TransportException
Description copied from interface: Router
Sends a datagram message. No response is expected.

Specified by:
sendDatagram in interface Router
Parameters:
data -
Returns:
Throws:
TransportException

sendRequest

public Msg sendRequest(URI to,
                       Msg data)
                throws TransportException
Description copied from interface: Router
Sends a request message to the other end.

Specified by:
sendRequest in interface Router
Parameters:
data -
Returns:
Throws:
TransportException

sendResponse

public void sendResponse(Msg data,
                         int requestId)
                  throws TransportException
Throws:
TransportException

getCreatedChannelCount

public int getCreatedChannelCount()

getBackConnectURI

public URI getBackConnectURI()
Returns:
Returns the backConnectURI.

setBackConnectURI

public void setBackConnectURI(URI backConnectURI)
Parameters:
backConnectURI - The backConnectURI to set.


Copyright © 2003-2005 Apache Software Foundation. All Rights Reserved.