org.objectweb.tribe.channel.tcp
Class TcpChannelPool

java.lang.Object
  extended byorg.objectweb.tribe.channel.AbstractChannelPool
      extended byorg.objectweb.tribe.channel.tcp.TcpChannelPool

public class TcpChannelPool
extends AbstractChannelPool

This class defines a TcpChannelPool

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
 
Fields inherited from class org.objectweb.tribe.channel.AbstractChannelPool
channels, keyBuffers, serverChannels
 
Constructor Summary
TcpChannelPool()
          Creates a new TcpChannelPool object
 
Method Summary
 AbstractReliableFifoChannel getChannel(Address destination)
          Get a reliable fifo serverSocket to the given destination.
static AbstractChannelPool getChannelPool()
          Returns a static instance of the serverSocket pool.
 AbstractServerChannel getServerChannel(Address serverAddress)
          Get a server socket on the given address.
 boolean removeChannelFromPool(AbstractReliableFifoChannel channel)
          Terminates the TCP reader thread as well.
 boolean removeServerChannelFromPool(AbstractServerChannel channel)
          Terminates the TCP accepter thread as well.
 
Methods inherited from class org.objectweb.tribe.channel.AbstractChannelPool
registerReceiveBuffer, send, unregisterReceiveBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcpChannelPool

public TcpChannelPool()
Creates a new TcpChannelPool object

Method Detail

getChannel

public AbstractReliableFifoChannel getChannel(Address destination)
                                       throws ChannelException
Description copied from class: AbstractChannelPool
Get a reliable fifo serverSocket to the given destination.

If no serverSocket exist, a new one is created else an existing one may be returned.

Specified by:
getChannel in class AbstractChannelPool
Parameters:
destination - destination address to reach
Returns:
a reliable fifo serverSocket
Throws:
ChannelException - if an error occurs
See Also:
org.objectweb.tribe.serverSocket.pool.AbstractChannelPool#getChannel(org.objectweb.tribe.common.Address)

getServerChannel

public AbstractServerChannel getServerChannel(Address serverAddress)
                                       throws ChannelException
Description copied from class: AbstractChannelPool
Get a server socket on the given address.

If no server Socket exist, a new one is created else an existing one may be returned.

Specified by:
getServerChannel in class AbstractChannelPool
Parameters:
serverAddress - server address to bind
Returns:
a server serverSocket
Throws:
ChannelException - if an error occurs
See Also:
AbstractChannelPool.getServerChannel(org.objectweb.tribe.common.Address)

getChannelPool

public static AbstractChannelPool getChannelPool()
Returns a static instance of the serverSocket pool.

Returns:
a TcpChannelPool

removeChannelFromPool

public boolean removeChannelFromPool(AbstractReliableFifoChannel channel)
Terminates the TCP reader thread as well.

Overrides:
removeChannelFromPool in class AbstractChannelPool
Parameters:
channel - the channel to remove
Returns:
true if the channel was removed from the pool, false if the channel wasn't found in the pool.
See Also:
AbstractChannelPool.removeChannelFromPool(org.objectweb.tribe.channel.AbstractReliableFifoChannel)

removeServerChannelFromPool

public boolean removeServerChannelFromPool(AbstractServerChannel channel)
Terminates the TCP accepter thread as well.

Overrides:
removeServerChannelFromPool in class AbstractChannelPool
Parameters:
channel - the channel to remove
Returns:
true if the channel was removed from the pool, false if the channel wasn't found in the pool.
See Also:
AbstractChannelPool.removeServerChannelFromPool(org.objectweb.tribe.channel.AbstractServerChannel)


Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.