com.caucho.network.listen
Class TcpSocketLinkListener

java.lang.Object
  extended by com.caucho.network.listen.TcpSocketLinkListener
Direct Known Subclasses:
ClusterListener, OpenPort, ProtocolPortConfig

@Configurable
public class TcpSocketLinkListener
extends java.lang.Object

Represents a protocol connection.


Nested Class Summary
 class TcpSocketLinkListener.SuspendReaper
           
 
Constructor Summary
TcpSocketLinkListener()
           
 
Method Summary
 void addContentProgram(ConfigProgram program)
          Ignore unknown tags.
 void bind()
          Starts the port listening.
 void bind(QServerSocket ss)
          Starts the port listening.
 QServerSocket bindForWatchdog()
          binds for the watchdog.
 void close()
          Shuts the Port down.
 JsseSSLFactory createJsse()
          Sets the SSL factory
 SSLFactory createOpenssl()
          Sets the SSL factory
 void disable()
          Stops the port from listening for new connections.
 void enable()
          Starts the port listening for new connections.
 TcpSocketLink findConnectionByThreadId(long threadId)
          Find the TcpConnection based on the thread id (for admin)
 int getAcceptListenBacklog()
          The operating system listen backlog
 long getAcceptThreadIdleTimeout()
          Sets the minimum spare idle timeout.
 int getAcceptThreadMax()
          The maximum spare threads.
 int getAcceptThreadMin()
          The minimum spare threads.
 int getActiveConnectionCount()
          Returns the active connections.
 int getActiveThreadCount()
          Returns the active thread count.
 java.lang.String getAddress()
          Gets the IP address
 PortMXBean getAdmin()
           
 long getBlockingTimeoutForSelect()
           
 java.lang.ClassLoader getClassLoader()
           
 int getCometIdleCount()
          Returns the number of comet connections.
 int getConnectionCount()
          Returns the number of connections
 int getConnectionMax()
          Gets the connection max.
 java.lang.String getDebugId()
           
 int getDuplexCount()
          Returns the number of duplex connections.
 int getIdleThreadCount()
          Returns the count of idle threads.
 int getKeepaliveConnectionCount()
          Returns the keepalive connections.
 long getKeepaliveConnectionTimeMax()
          Gets the keepalive max.
 int getKeepaliveCount()
          Returns the number of keepalive connections
 int getKeepaliveMax()
          Gets the keepalive max.
 int getKeepaliveSelectMax()
           
 long getKeepaliveSelectThreadTimeout()
           
 int getKeepaliveThreadCount()
          Returns the number of keepalive connections
 long getKeepaliveThreadTimeout()
           
 long getKeepaliveTimeout()
           
 Lifecycle getLifecycleState()
           
 long getLifetimeClientDisconnectCount()
           
 long getLifetimeKeepaliveCount()
           
 long getLifetimeReadBytes()
           
 long getLifetimeRequestCount()
           
 long getLifetimeRequestTime()
           
 long getLifetimeWriteBytes()
           
 int getLocalPort()
          Gets the local port (for ephemeral ports)
 int getPort()
          Gets the port.
 Protocol getProtocol()
          Returns the protocol handler responsible for generating protocol-specific ProtocolConnections.
 java.lang.String getProtocolName()
          Gets the protocol name.
 long getRequestTimeout()
          Returns the max time for a request.
 int getSelectConnectionCount()
          Returns the number of connections in the select.
 AbstractSelectManager getSelectManager()
          returns the select manager.
 java.lang.String getServerSocketClassName()
          Returns the server socket class name for debugging.
 long getSocketTimeout()
          Gets the read timeout for the accepted sockets.
 SSLFactory getSSL()
          Gets the SSL factory.
 int getStartThreadCount()
          Returns the count of start threads.
 long getSuspendTimeMax()
          Gets the suspend max.
 int getThreadCount()
          Returns the thread count.
 long getThrottleConcurrentMax()
          Configures the throttle.
 java.lang.String getUrl()
           
 java.lang.String getVirtualHost()
          Gets the virtual host for IP-based virtual host.
 void init()
          Initializes the port.
 boolean isActive()
          Returns true if the port is active.
 boolean isAfterBind()
           
 boolean isClosed()
          Returns true if the port is closed.
 boolean isEnabled()
           
 boolean isJniEnabled()
           
 boolean isKeepaliveSelectEnabled()
           
 boolean isSecure()
          Return true for secure
 boolean isSSL()
          Returns true for ssl.
 boolean isTcpKeepalive()
           
 boolean isTcpNoDelay()
          Gets the tcp-no-delay property
 void postBind()
           
 void setAcceptListenBacklog(int listen)
          Sets the operating system listen backlog
 void setAcceptThreadIdleTimeout(Period timeout)
          Sets the minimum spare idle timeout.
 void setAcceptThreadMax(int maxSpare)
          Sets the minimum spare listen.
 void setAcceptThreadMin(int minSpare)
          Sets the minimum spare listen.
 void setAddress(java.lang.String address)
          Sets the address
 void setConnectionMax(int max)
          Sets the connection max.
 void setEnableJni(boolean isEnableJni)
           
 void setHost(java.lang.String address)
          Deprecated.  
 void setId(java.lang.String id)
          Deprecated. 
 void setJsseSsl(JsseSSLFactory factory)
          Sets the SSL factory
 void setKeepaliveConnectionTimeMax(Period period)
          Sets the keepalive max.
 void setKeepaliveConnectionTimeMaxMillis(long timeout)
           
 void setKeepaliveMax(int max)
          Sets the keepalive max.
 void setKeepaliveSelectEnable(boolean isKeepaliveSelect)
           
 void setKeepaliveSelectEnabled(boolean isKeepaliveSelect)
           
 void setKeepaliveSelectMax(int max)
           
 void setKeepaliveSelectThreadTimeout(Period period)
           
 void setKeepaliveSelectThreadTimeoutMillis(long timeout)
           
 void setKeepaliveThreadTimeout(Period period)
           
 void setKeepaliveTimeout(Period period)
           
 void setKeepaliveTimeoutMillis(long timeout)
           
 void setPort(int port)
          Sets the port.
 void setProtocol(Protocol protocol)
          Set protocol.
 void setRequestTimeout(Period period)
           
 void setSecure(boolean isSecure)
          Sets true for secure
 void setServerSocket(QServerSocket socket)
          Sets the server socket.
 void setSocketTimeout(Period period)
          Sets the read/write timeout for the accepted sockets.
 void setSocketTimeoutMillis(long timeout)
          Sets the read/write timeout for the accepted sockets.
 void setSSL(SSLFactory factory)
          Sets the SSL factory
 void setSuspendReaperTimeout(Period period)
           
 void setSuspendTimeMax(Period period)
           
 void setTcpKeepalive(boolean tcpKeepalive)
          Sets the tcp-keepalive property
 void setTcpNoDelay(boolean tcpNoDelay)
          Sets the tcp-no-delay property
 void setThrottleConcurrentMax(int max)
          Configures the throttle.
 void setThrottleLimit(int limit)
          Sets the throttle limit.
 void setThrottlePeriod(long period)
          Sets the throttle period.
 void setThrottleSleepTime(long period)
          Sets the throttle sleep time.
 void setVirtualHost(java.lang.String host)
          Sets the virtual host for IP-based virtual host.
 void start()
          Starts the port listening.
 java.lang.String toString()
           
 java.lang.String toURL()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TcpSocketLinkListener

public TcpSocketLinkListener()
Method Detail

setId

@Deprecated
public void setId(java.lang.String id)
Deprecated. 

Sets the id.


getDebugId

public java.lang.String getDebugId()

getClassLoader

public java.lang.ClassLoader getClassLoader()

getAdmin

public PortMXBean getAdmin()

setProtocol

public void setProtocol(Protocol protocol)
                 throws ConfigException
Set protocol.

Throws:
ConfigException

getProtocol

public Protocol getProtocol()
Returns the protocol handler responsible for generating protocol-specific ProtocolConnections.


getProtocolName

public java.lang.String getProtocolName()
Gets the protocol name.


setAddress

@Configurable
public void setAddress(java.lang.String address)
                throws java.net.UnknownHostException
Sets the address

Throws:
java.net.UnknownHostException

getAddress

public java.lang.String getAddress()
Gets the IP address


setHost

public void setHost(java.lang.String address)
             throws java.net.UnknownHostException
Deprecated. 

Throws:
java.net.UnknownHostException

setPort

@Configurable
public void setPort(int port)
Sets the port.


getPort

public int getPort()
Gets the port.


getLocalPort

public int getLocalPort()
Gets the local port (for ephemeral ports)


setVirtualHost

@Configurable
public void setVirtualHost(java.lang.String host)
Sets the virtual host for IP-based virtual host.


getVirtualHost

public java.lang.String getVirtualHost()
Gets the virtual host for IP-based virtual host.


setSSL

public void setSSL(SSLFactory factory)
Sets the SSL factory


createOpenssl

@Configurable
public SSLFactory createOpenssl()
                         throws ConfigException
Sets the SSL factory

Throws:
ConfigException

createJsse

public JsseSSLFactory createJsse()
Sets the SSL factory


setJsseSsl

public void setJsseSsl(JsseSSLFactory factory)
Sets the SSL factory


getSSL

public SSLFactory getSSL()
Gets the SSL factory.


isSSL

public boolean isSSL()
Returns true for ssl.


setSecure

@Configurable
public void setSecure(boolean isSecure)
Sets true for secure


isSecure

public boolean isSecure()
Return true for secure


setServerSocket

public void setServerSocket(QServerSocket socket)
Sets the server socket.


setAcceptThreadMin

@Configurable
public void setAcceptThreadMin(int minSpare)
                        throws ConfigException
Sets the minimum spare listen.

Throws:
ConfigException

getAcceptThreadMin

public int getAcceptThreadMin()
The minimum spare threads.


setAcceptThreadMax

@Configurable
public void setAcceptThreadMax(int maxSpare)
                        throws ConfigException
Sets the minimum spare listen.

Throws:
ConfigException

getAcceptThreadMax

public int getAcceptThreadMax()
The maximum spare threads.


setAcceptThreadIdleTimeout

@Configurable
public void setAcceptThreadIdleTimeout(Period timeout)
                                throws ConfigException
Sets the minimum spare idle timeout.

Throws:
ConfigException

getAcceptThreadIdleTimeout

public long getAcceptThreadIdleTimeout()
                                throws ConfigException
Sets the minimum spare idle timeout.

Throws:
ConfigException

setThrottlePeriod

public void setThrottlePeriod(long period)
Sets the throttle period.


setThrottleLimit

public void setThrottleLimit(int limit)
Sets the throttle limit.


setThrottleSleepTime

public void setThrottleSleepTime(long period)
Sets the throttle sleep time.


setAcceptListenBacklog

@Configurable
public void setAcceptListenBacklog(int listen)
                            throws ConfigException
Sets the operating system listen backlog

Throws:
ConfigException

getAcceptListenBacklog

public int getAcceptListenBacklog()
The operating system listen backlog


setConnectionMax

@Configurable
public void setConnectionMax(int max)
Sets the connection max.


getConnectionMax

public int getConnectionMax()
Gets the connection max.


setSocketTimeout

@Configurable
public void setSocketTimeout(Period period)
Sets the read/write timeout for the accepted sockets.


setSocketTimeoutMillis

public void setSocketTimeoutMillis(long timeout)
Sets the read/write timeout for the accepted sockets.


getSocketTimeout

public long getSocketTimeout()
Gets the read timeout for the accepted sockets.


setRequestTimeout

public void setRequestTimeout(Period period)

getRequestTimeout

public long getRequestTimeout()
Returns the max time for a request.


isTcpNoDelay

public boolean isTcpNoDelay()
Gets the tcp-no-delay property


setTcpNoDelay

@Configurable
public void setTcpNoDelay(boolean tcpNoDelay)
Sets the tcp-no-delay property


setTcpKeepalive

@Configurable
public void setTcpKeepalive(boolean tcpKeepalive)
Sets the tcp-keepalive property


isTcpKeepalive

public boolean isTcpKeepalive()

setThrottleConcurrentMax

@Configurable
public void setThrottleConcurrentMax(int max)
Configures the throttle.


getThrottleConcurrentMax

public long getThrottleConcurrentMax()
Configures the throttle.


setEnableJni

public void setEnableJni(boolean isEnableJni)

isJniEnabled

public boolean isJniEnabled()

setKeepaliveMax

public void setKeepaliveMax(int max)
Sets the keepalive max.


getKeepaliveMax

public int getKeepaliveMax()
Gets the keepalive max.


setKeepaliveConnectionTimeMax

public void setKeepaliveConnectionTimeMax(Period period)
Sets the keepalive max.


getKeepaliveConnectionTimeMax

public long getKeepaliveConnectionTimeMax()
Gets the keepalive max.


setKeepaliveConnectionTimeMaxMillis

public void setKeepaliveConnectionTimeMaxMillis(long timeout)

getSuspendTimeMax

public long getSuspendTimeMax()
Gets the suspend max.


setSuspendTimeMax

public void setSuspendTimeMax(Period period)

setSuspendReaperTimeout

public void setSuspendReaperTimeout(Period period)

setKeepaliveTimeout

public void setKeepaliveTimeout(Period period)

getKeepaliveTimeout

public long getKeepaliveTimeout()

setKeepaliveTimeoutMillis

public void setKeepaliveTimeoutMillis(long timeout)

isKeepaliveSelectEnabled

public boolean isKeepaliveSelectEnabled()

setKeepaliveSelectEnabled

public void setKeepaliveSelectEnabled(boolean isKeepaliveSelect)

setKeepaliveSelectEnable

public void setKeepaliveSelectEnable(boolean isKeepaliveSelect)

setKeepaliveSelectMax

public void setKeepaliveSelectMax(int max)

getKeepaliveSelectThreadTimeout

public long getKeepaliveSelectThreadTimeout()

getKeepaliveThreadTimeout

public long getKeepaliveThreadTimeout()

setKeepaliveSelectThreadTimeout

public void setKeepaliveSelectThreadTimeout(Period period)

setKeepaliveThreadTimeout

public void setKeepaliveThreadTimeout(Period period)

setKeepaliveSelectThreadTimeoutMillis

public void setKeepaliveSelectThreadTimeoutMillis(long timeout)

getBlockingTimeoutForSelect

public long getBlockingTimeoutForSelect()

getKeepaliveSelectMax

public int getKeepaliveSelectMax()

addContentProgram

@Configurable
public void addContentProgram(ConfigProgram program)
Ignore unknown tags. server/0940


getThreadCount

public int getThreadCount()
Returns the thread count.


getActiveThreadCount

public int getActiveThreadCount()
Returns the active thread count.


getIdleThreadCount

public int getIdleThreadCount()
Returns the count of idle threads.


getStartThreadCount

public int getStartThreadCount()
Returns the count of start threads.


getKeepaliveCount

public int getKeepaliveCount()
Returns the number of keepalive connections


getLifecycleState

public Lifecycle getLifecycleState()

isAfterBind

public boolean isAfterBind()

isActive

public boolean isActive()
Returns true if the port is active.


getActiveConnectionCount

public int getActiveConnectionCount()
Returns the active connections.


getKeepaliveConnectionCount

public int getKeepaliveConnectionCount()
Returns the keepalive connections.


getKeepaliveThreadCount

public int getKeepaliveThreadCount()
Returns the number of keepalive connections


getSelectConnectionCount

public int getSelectConnectionCount()
Returns the number of connections in the select.


getServerSocketClassName

public java.lang.String getServerSocketClassName()
Returns the server socket class name for debugging.


init

@PostConstruct
public void init()
          throws ConfigException
Initializes the port.

Throws:
ConfigException

getUrl

public java.lang.String getUrl()

bind

public void bind()
          throws java.lang.Exception
Starts the port listening.

Throws:
java.lang.Exception

bind

public void bind(QServerSocket ss)
          throws java.lang.Exception
Starts the port listening.

Throws:
java.lang.Exception

postBind

public void postBind()

bindForWatchdog

public QServerSocket bindForWatchdog()
                              throws java.io.IOException
binds for the watchdog.

Throws:
java.io.IOException

start

public void start()
           throws java.lang.Exception
Starts the port listening.

Throws:
java.lang.Exception

isEnabled

public boolean isEnabled()

enable

public void enable()
Starts the port listening for new connections.


disable

public void disable()
Stops the port from listening for new connections.


getSelectManager

public AbstractSelectManager getSelectManager()
returns the select manager.


isClosed

public boolean isClosed()
Returns true if the port is closed.


getConnectionCount

public int getConnectionCount()
Returns the number of connections


getCometIdleCount

public int getCometIdleCount()
Returns the number of comet connections.


getDuplexCount

public int getDuplexCount()
Returns the number of duplex connections.


getLifetimeRequestCount

public long getLifetimeRequestCount()

getLifetimeKeepaliveCount

public long getLifetimeKeepaliveCount()

getLifetimeClientDisconnectCount

public long getLifetimeClientDisconnectCount()

getLifetimeRequestTime

public long getLifetimeRequestTime()

getLifetimeReadBytes

public long getLifetimeReadBytes()

getLifetimeWriteBytes

public long getLifetimeWriteBytes()

findConnectionByThreadId

public TcpSocketLink findConnectionByThreadId(long threadId)
Find the TcpConnection based on the thread id (for admin)


close

public void close()
Shuts the Port down. The server gives connections 30 seconds to complete.


toURL

public java.lang.String toURL()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object