org.objectweb.dream.channel
Class IPSocketManagerTCPImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.channel.IPSocketManagerTCPImpl
All Implemented Interfaces:
AttributeController, BindingController, IPSocketManager, IPSocketManagerTCPAttributeController, LifeCycleController, Loggable

public class IPSocketManagerTCPImpl
extends AbstractComponent
implements IPSocketManager, IPSocketManagerTCPAttributeController

IPSocketManagerthat handles one TCP connection at a time. A new connection is established for each IPSocketManager.getSocket(InetAddress, int)method call, and connections are closed by IPSocketManager.releaseSocket(SocketState, boolean)method.


Field Summary
protected  int cnxRetry
           
static String SOCKET_STATE_POOL_ITF_NAME
          The name of the client interface used to pool socket state instances
protected  ObjectPool socketStatePoolItf
           
protected  int soLinger
           
protected  int soTimeout
           
protected  boolean tcpNoDelay
           
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, firstStart, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.channel.IPSocketManager
ITF_NAME
 
Fields inherited from interface org.objectweb.dream.channel.IPSocketManagerTCPAttributeController
CNX_RETRY_DEFAULT
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
IPSocketManagerTCPImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
 int getCnxRetry()
          Returns the number of connection retry before abording.
 SocketState getSocket(InetAddress address, int port)
          Returns a socket that can be used to send message to the ChannelIn identified by the given IP address and port.
 int getSoLinger()
          Returns the SO_LINGER parameter setted on created sockets.
 int getSoTimeout()
          Returns the SO_TIMEOUT parameter setted on created sockets.
 boolean getTcpNoDelay()
          Returns true if the Nagle's algorithm is disabled on created sockets.
 String[] listFc()
           
 void releaseSocket(SocketState socketState, boolean error)
          Releases the given SocketStateImpl.
 void setCnxRetry(int cnxRetry)
          Sets the cnxRetry attribute's value.
protected  void setSocketOption(Socket sock)
           
 void setSoLinger(int timeout)
          Sets the soLinger attribute's value.
 void setSoTimeout(int timeout)
          Sets the soTimeout attribute's value.
 void setTcpNoDelay(boolean tcpNoDelay)
          Sets the tcpNoDelay attribute's value.
 
Methods inherited from class org.objectweb.dream.AbstractComponent
beforeFirstStart, getFcState, initComponent, lookupFc, setLogger, startFc, stopFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cnxRetry

protected int cnxRetry

tcpNoDelay

protected boolean tcpNoDelay

soTimeout

protected int soTimeout

soLinger

protected int soLinger

SOCKET_STATE_POOL_ITF_NAME

public static final String SOCKET_STATE_POOL_ITF_NAME
The name of the client interface used to pool socket state instances

See Also:
Constant Field Values

socketStatePoolItf

protected ObjectPool socketStatePoolItf
Constructor Detail

IPSocketManagerTCPImpl

public IPSocketManagerTCPImpl()
Method Detail

getSocket

public SocketState getSocket(InetAddress address,
                             int port)
                      throws IOException
Description copied from interface: IPSocketManager
Returns a socket that can be used to send message to the ChannelIn identified by the given IP address and port.

Specified by:
getSocket in interface IPSocketManager
Parameters:
address - the address of the ChannelIn.
port - the port of the ChannelIn.
Returns:
a connection to the ChannelIn.
Throws:
IOException - if the socket can't be opened.
See Also:
IPSocketManager.getSocket(InetAddress, int)

releaseSocket

public void releaseSocket(SocketState socketState,
                          boolean error)
Description copied from interface: IPSocketManager
Releases the given SocketStateImpl.

Specified by:
releaseSocket in interface IPSocketManager
Parameters:
socketState - the socket state to release.
error - true if an exception has been catched while sending the message, false otherwise.
See Also:
IPSocketManager.releaseSocket(SocketState, boolean)

setSocketOption

protected void setSocketOption(Socket sock)
                        throws SocketException
Throws:
SocketException

getCnxRetry

public int getCnxRetry()
Description copied from interface: IPSocketManagerTCPAttributeController
Returns the number of connection retry before abording.

Specified by:
getCnxRetry in interface IPSocketManagerTCPAttributeController
Returns:
IPSocketManagerTCPAttributeController.CNX_RETRY_DEFAULTby default, or the value setted by IPSocketManagerTCPAttributeController.setCnxRetry(int).
See Also:
IPSocketManagerTCPAttributeController.getCnxRetry()

setCnxRetry

public void setCnxRetry(int cnxRetry)
Description copied from interface: IPSocketManagerTCPAttributeController
Sets the cnxRetry attribute's value.

Specified by:
setCnxRetry in interface IPSocketManagerTCPAttributeController
Parameters:
cnxRetry - the number of connection retry before abording.
See Also:
IPSocketManagerTCPAttributeController.setCnxRetry(int)

getTcpNoDelay

public boolean getTcpNoDelay()
Description copied from interface: IPSocketManagerTCPAttributeController
Returns true if the Nagle's algorithm is disabled on created sockets.

Specified by:
getTcpNoDelay in interface IPSocketManagerTCPAttributeController
Returns:
the tcpNoDelay attribute's value.
See Also:
IPSocketManagerTCPAttributeController.getTcpNoDelay()

setTcpNoDelay

public void setTcpNoDelay(boolean tcpNoDelay)
Description copied from interface: IPSocketManagerTCPAttributeController
Sets the tcpNoDelay attribute's value.

Specified by:
setTcpNoDelay in interface IPSocketManagerTCPAttributeController
Parameters:
tcpNoDelay - the new tcpNoDelay attribute's value.
See Also:
IPSocketManagerTCPAttributeController.setTcpNoDelay(boolean)

getSoTimeout

public int getSoTimeout()
Description copied from interface: IPSocketManagerTCPAttributeController
Returns the SO_TIMEOUT parameter setted on created sockets.

Specified by:
getSoTimeout in interface IPSocketManagerTCPAttributeController
Returns:
the soTimeout attribute's value.
See Also:
IPSocketManagerTCPAttributeController.getSoTimeout()

setSoTimeout

public void setSoTimeout(int timeout)
Description copied from interface: IPSocketManagerTCPAttributeController
Sets the soTimeout attribute's value.

Specified by:
setSoTimeout in interface IPSocketManagerTCPAttributeController
Parameters:
timeout - the new soTimeout attribute's value.
See Also:
IPSocketManagerTCPAttributeController.setSoTimeout(int)

getSoLinger

public int getSoLinger()
Description copied from interface: IPSocketManagerTCPAttributeController
Returns the SO_LINGER parameter setted on created sockets. A negative value disable the linger on close.

Specified by:
getSoLinger in interface IPSocketManagerTCPAttributeController
Returns:
the soLinger attribute's value.
See Also:
IPSocketManagerTCPAttributeController.getSoLinger()

setSoLinger

public void setSoLinger(int timeout)
Description copied from interface: IPSocketManagerTCPAttributeController
Sets the soLinger attribute's value.

Specified by:
setSoLinger in interface IPSocketManagerTCPAttributeController
Parameters:
timeout - the new soLinger attribute's value.
See Also:
IPSocketManagerTCPAttributeController.setSoLinger(int)

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController
See Also:
BindingController.listFc()

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.bindFc(String, Object)


Copyright © 2003, 2004 - INRIA Rhone-Alpes - All Rights Reserved.