org.objectweb.dream.channel
Class TCPAcceptSocketImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.channel.AbstractAcceptSocketImpl
          extended byorg.objectweb.dream.channel.TCPAcceptSocketImpl
All Implemented Interfaces:
AttributeController, BindingController, LifeCycleController, Loggable, TCPAcceptSocketAttributeController

public class TCPAcceptSocketImpl
extends AbstractAcceptSocketImpl
implements TCPAcceptSocketAttributeController

Wraps TCP ServerSocket.


Nested Class Summary
 
Nested classes inherited from class org.objectweb.dream.channel.AbstractAcceptSocketImpl
AbstractAcceptSocketImpl.AcceptTask
 
Field Summary
protected  ServerSocket listen
          The ServerSocketused by this component
protected  int listeningPort
           
protected  int openRetry
           
protected  int soLinger
           
protected  int soTimeout
           
protected  boolean tcpNoDelay
           
 
Fields inherited from class org.objectweb.dream.channel.AbstractAcceptSocketImpl
acceptTask, openedSocketItf
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, firstStart, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.channel.TCPAcceptSocketAttributeController
OPEN_RETRY_DEFAULT
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
TCPAcceptSocketImpl()
           
 
Method Summary
protected  SocketState acceptSocket()
          Abstract method that return a newly accepted socket.
protected  ServerSocket createServerSocket()
           
 int getListeningPort()
          Returns the listening port.
 int getOpenRetry()
          Returns the number of attempts to open a ServerSocket before aborting.
 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.
 void setListeningPort(int port)
          Sets the listeningPort attribute's value.
 void setOpenRetry(int retry)
          Sets the openRetry 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.
 void startFc()
           
 void stopFc()
           
 
Methods inherited from class org.objectweb.dream.channel.AbstractAcceptSocketImpl
beforeFirstStart, bindFc, listFc
 
Methods inherited from class org.objectweb.dream.AbstractComponent
getFcState, initComponent, lookupFc, setLogger, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listen

protected ServerSocket listen
The ServerSocketused by this component


listeningPort

protected int listeningPort

openRetry

protected int openRetry

tcpNoDelay

protected boolean tcpNoDelay

soTimeout

protected int soTimeout

soLinger

protected int soLinger
Constructor Detail

TCPAcceptSocketImpl

public TCPAcceptSocketImpl()
Method Detail

acceptSocket

protected SocketState acceptSocket()
                            throws IOException
Description copied from class: AbstractAcceptSocketImpl
Abstract method that return a newly accepted socket.

Specified by:
acceptSocket in class AbstractAcceptSocketImpl
Throws:
IOException
See Also:
AbstractAcceptSocketImpl.acceptSocket()

getListeningPort

public int getListeningPort()
Description copied from interface: TCPAcceptSocketAttributeController
Returns the listening port.

Specified by:
getListeningPort in interface TCPAcceptSocketAttributeController
Returns:
the listeningPort attribute's value.
See Also:
TCPAcceptSocketAttributeController.getListeningPort()

setListeningPort

public void setListeningPort(int port)
                      throws IllegalLifeCycleException
Description copied from interface: TCPAcceptSocketAttributeController
Sets the listeningPort attribute's value.

Specified by:
setListeningPort in interface TCPAcceptSocketAttributeController
Parameters:
port - the new listeningPort attribute's value.
Throws:
IllegalLifeCycleException - cannot change port number if the component is started.
See Also:
TCPAcceptSocketAttributeController.setListeningPort(int)

getOpenRetry

public int getOpenRetry()
Description copied from interface: TCPAcceptSocketAttributeController
Returns the number of attempts to open a ServerSocket before aborting.

Specified by:
getOpenRetry in interface TCPAcceptSocketAttributeController
Returns:
the openRetry attribute's value.
See Also:
TCPAcceptSocketAttributeController.getOpenRetry()

setOpenRetry

public void setOpenRetry(int retry)
Description copied from interface: TCPAcceptSocketAttributeController
Sets the openRetry attribute's value.

Specified by:
setOpenRetry in interface TCPAcceptSocketAttributeController
Parameters:
retry - the new openRetry attribute's value.
See Also:
TCPAcceptSocketAttributeController.setOpenRetry(int)

getSoLinger

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

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

setSoLinger

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

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

getSoTimeout

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

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

setSoTimeout

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

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

getTcpNoDelay

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

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

setTcpNoDelay

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

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

startFc

public void startFc()
             throws IllegalLifeCycleException
Specified by:
startFc in interface LifeCycleController
Throws:
IllegalLifeCycleException
See Also:
LifeCycleController.startFc()

stopFc

public void stopFc()
            throws IllegalLifeCycleException
Specified by:
stopFc in interface LifeCycleController
Throws:
IllegalLifeCycleException
See Also:
LifeCycleController.stopFc()

createServerSocket

protected ServerSocket createServerSocket()
                                   throws IOException
Throws:
IOException

setSocketOption

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


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