Apache Tomcat 7.0.2

org.apache.tomcat.util.net
Class JIoEndpoint

java.lang.Object
  extended by org.apache.tomcat.util.net.AbstractEndpoint
      extended by org.apache.tomcat.util.net.JIoEndpoint

public class JIoEndpoint
extends AbstractEndpoint

Handle incoming TCP connections. This class implement a simple server model: one listener thread accepts on a socket and creates a new worker thread for each incoming connection. More advanced Endpoints will reuse the threads, use queues, etc.

Author:
James Duncan Davidson, Jason Hunter, James Todd, Costin Manolache, Gal Shachor, Yoav Shapira, Remy Maucherat

Nested Class Summary
protected  class JIoEndpoint.Acceptor
          Server socket acceptor thread.
protected  class JIoEndpoint.AsyncTimeout
          Async timeout thread
static interface JIoEndpoint.Handler
          Bare bones interface used for socket processing.
protected  class JIoEndpoint.SocketProcessor
          This class is the equivalent of the Worker, but will simply use in an external Executor thread pool.
 
Field Summary
protected  int acceptorThreadCount
          Acceptor thread count.
protected  JIoEndpoint.Handler handler
          Handling of accepted sockets.
protected  ServerSocket serverSocket
          Associated server socket.
protected  ServerSocketFactory serverSocketFactory
          Server socket factory.
protected  ConcurrentLinkedQueue<SocketWrapper<Socket>> waitingRequests
           
 
Fields inherited from class org.apache.tomcat.util.net.AbstractEndpoint
CERTIFICATE_KEY, CIPHER_SUITE_KEY, initialized, internalExecutor, KEY_SIZE_KEY, paused, running, SESSION_ID_KEY, SESSION_MGR, sm, socketProperties, SSL_ATTR_ALGORITHM, SSL_ATTR_ALLOW_UNSAFE_RENEG, SSL_ATTR_CIPHERS, SSL_ATTR_CIPHERS_ARRAY, SSL_ATTR_CLIENT_AUTH, SSL_ATTR_CRL_FILE, SSL_ATTR_KEY_ALIAS, SSL_ATTR_KEY_PASS, SSL_ATTR_KEYSTORE_FILE, SSL_ATTR_KEYSTORE_PASS, SSL_ATTR_KEYSTORE_PROVIDER, SSL_ATTR_KEYSTORE_TYPE, SSL_ATTR_SESSION_CACHE_SIZE, SSL_ATTR_SESSION_TIMEOUT, SSL_ATTR_SSL_PROTOCOL, SSL_ATTR_TRUST_MAX_CERT_LENGTH, SSL_ATTR_TRUSTSTORE_ALGORITHM, SSL_ATTR_TRUSTSTORE_FILE, SSL_ATTR_TRUSTSTORE_PASS, SSL_ATTR_TRUSTSTORE_PROVIDER, SSL_ATTR_TRUSTSTORE_TYPE, threadPriority
 
Constructor Summary
JIoEndpoint()
           
 
Method Summary
 void destroy()
          Deallocate APR memory pools, and close server socket.
 int getAcceptorThreadCount()
           
 JIoEndpoint.Handler getHandler()
           
 ServerSocketFactory getServerSocketFactory()
           
 void init()
           
 void pause()
           
protected  boolean processSocket(Socket socket)
          Process given socket.
 boolean processSocket(SocketWrapper<Socket> socket, SocketStatus status)
           
 void resume()
           
 void setAcceptorThreadCount(int acceptorThreadCount)
           
 void setHandler(JIoEndpoint.Handler handler)
           
 boolean setProperty(String name, String value)
          Generic properties - currently only socket.xxx properties
 void setServerSocketFactory(ServerSocketFactory factory)
           
protected  boolean setSocketOptions(Socket socket)
          Set the options for the current socket.
 void start()
           
 void stop()
           
 
Methods inherited from class org.apache.tomcat.util.net.AbstractEndpoint
adjustRelativePath, createExecutor, defaultIfNull, getAddress, getAlgorithm, getAllowUnsafeLegacyRenegotiation, getBacklog, getCiphers, getCiphersArray, getClientAuth, getCrlFile, getCurrentThreadCount, getCurrentThreadsBusy, getDaemon, getExecutor, getKeepAliveTimeout, getKeyAlias, getKeyPass, getKeystoreFile, getKeystorePass, getKeystoreProvider, getKeystoreType, getMaxConnections, getMaxKeepAliveRequests, getMaxThreads, getMinSpareThreads, getName, getPort, getSessionCacheSize, getSessionTimeout, getSocketProperties, getSoLinger, getSoTimeout, getSslEnabledProtocolsArray, getSslProtocol, getTcpNoDelay, getThreadPriority, getTrustMaxCertLength, getTruststoreAlgorithm, getTruststoreFile, getTruststorePass, getTruststoreProvider, getTruststoreType, isPaused, isRunning, isSSLEnabled, setAddress, setAlgorithm, setAllowUnsafeLegacyRenegotiation, setBacklog, setCiphers, setClientAuth, setCrlFile, setDaemon, setExecutor, setKeepAliveTimeout, setKeyAlias, setKeyPass, setKeystoreFile, setKeystorePass, setKeystoreProvider, setKeystoreType, setMaxConnections, setMaxKeepAliveRequests, setMaxThreads, setMinSpareThreads, setName, setPort, setSessionCacheSize, setSessionTimeout, setSoLinger, setSoTimeout, setSSLEnabled, setSslEnabledProtocols, setSslProtocol, setTcpNoDelay, setThreadPriority, setTrustMaxCertLength, setTruststoreAlgorithm, setTruststoreFile, setTruststorePass, setTruststoreProvider, setTruststoreType, shutdownExecutor, unlockAccept
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serverSocket

protected ServerSocket serverSocket
Associated server socket.


acceptorThreadCount

protected int acceptorThreadCount
Acceptor thread count.


handler

protected JIoEndpoint.Handler handler
Handling of accepted sockets.


serverSocketFactory

protected ServerSocketFactory serverSocketFactory
Server socket factory.


waitingRequests

protected ConcurrentLinkedQueue<SocketWrapper<Socket>> waitingRequests
Constructor Detail

JIoEndpoint

public JIoEndpoint()
Method Detail

setProperty

public boolean setProperty(String name,
                           String value)
Generic properties - currently only socket.xxx properties

Overrides:
setProperty in class AbstractEndpoint

setAcceptorThreadCount

public void setAcceptorThreadCount(int acceptorThreadCount)

getAcceptorThreadCount

public int getAcceptorThreadCount()

setHandler

public void setHandler(JIoEndpoint.Handler handler)

getHandler

public JIoEndpoint.Handler getHandler()

setServerSocketFactory

public void setServerSocketFactory(ServerSocketFactory factory)

getServerSocketFactory

public ServerSocketFactory getServerSocketFactory()

init

public void init()
          throws Exception
Specified by:
init in class AbstractEndpoint
Throws:
Exception

start

public void start()
           throws Exception
Specified by:
start in class AbstractEndpoint
Throws:
Exception

pause

public void pause()
Specified by:
pause in class AbstractEndpoint

resume

public void resume()
Specified by:
resume in class AbstractEndpoint

stop

public void stop()

destroy

public void destroy()
             throws Exception
Deallocate APR memory pools, and close server socket.

Specified by:
destroy in class AbstractEndpoint
Throws:
Exception

setSocketOptions

protected boolean setSocketOptions(Socket socket)
Set the options for the current socket.


processSocket

protected boolean processSocket(Socket socket)
Process given socket.


processSocket

public boolean processSocket(SocketWrapper<Socket> socket,
                             SocketStatus status)

Apache Tomcat 7.0.2

Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.