JIoEndpoint (Apache Tomcat 6.0.51 API Documentation)
Keywords: org.apache.tomcat.util.net.JIoEndpoint class

Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 6.0.51
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tomcat.util.net
Class JIoEndpoint

    java.lang.Object
      org.apache.tomcat.util.net.AbstractEndpoint
          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.
`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.
`protected class` | `JIoEndpoint.Worker`
`class` | `JIoEndpoint.WorkerStack`

Field Summary
`protected int` | `acceptorThreadCount` Acceptor thread count.
`protected java.net.InetAddress` | `address` Address for the server socket.
`protected int` | `backlog` Allows the server developer to specify the backlog that should be used for server sockets.
`static java.lang.String` | `CERTIFICATE_KEY` The Request attribute key for the client certificate chain.
`static java.lang.String` | `CIPHER_SUITE_KEY` The Request attribute key for the cipher suite.
`protected int` | `curThreads` Current worker threads count.
`protected int` | `curThreadsBusy` Current worker threads busy count.
`protected boolean` | `daemon` The default is true - the created threads will be in daemon mode.
`protected java.util.concurrent.Executor` | `executor` External Executor based thread pool.
`protected JIoEndpoint.Handler` | `handler` Handling of accepted sockets.
`protected boolean` | `initialized` Track the initialization state of the endpoint.
`static java.lang.String` | `KEY_SIZE_KEY` The Request attribute key for the key size.
`protected static Log` | `log`
`protected int` | `maxThreads` Maximum amount of worker threads.
`protected java.lang.String` | `name` Name of the thread pool, which will be used for naming child threads.
`protected boolean` | `paused` Will be set to true whenever the endpoint is paused.
`protected int` | `port` Server socket port.
`protected boolean` | `running` Running state of the endpoint.
`protected int` | `sequence` Sequence number used to generate thread names.
`protected java.net.ServerSocket` | `serverSocket` Associated server socket.
`protected ServerSocketFactory` | `serverSocketFactory` Server socket factory.
`static java.lang.String` | `SESSION_ID_KEY` The Request attribute key for the session id.
`protected StringManager` | `sm`
`protected int` | `soLinger` Socket linger.
`protected int` | `soTimeout` Socket timeout.
`protected boolean` | `tcpNoDelay` Socket TCP no delay.
`protected int` | `threadPriority` Priority of the acceptor and poller threads.
`protected int` | `unlockTimeout` Unlock timeout.
`protected JIoEndpoint.WorkerStack` | `workers` Available workers.

Constructor Summary
`JIoEndpoint()`

Method Summary
`protected JIoEndpoint.Worker` | `createWorkerThread()` Create (or allocate) and return an available processor for use in processing a specific HTTP request, if possible.
`void` | `destroy()` Deallocate APR memory pools, and close server socket.
`int` | `getAcceptorThreadCount()`
`java.net.InetAddress` | `getAddress()`
`int` | `getBacklog()`
`int` | `getCurrentThreadCount()` Return the amount of threads that are managed by the pool.
`int` | `getCurrentThreadsBusy()` Return the amount of threads that are in use
`boolean` | `getDaemon()`
`java.util.concurrent.Executor` | `getExecutor()`
`JIoEndpoint.Handler` | `getHandler()`
`int` | `getLocalPort()` Port in use.
`int` | `getMaxThreads()`
`java.lang.String` | `getName()`
`int` | `getPort()`
`ServerSocketFactory` | `getServerSocketFactory()`
`int` | `getSoLinger()`
`int` | `getSoTimeout()`
`boolean` | `getTcpNoDelay()`
`int` | `getThreadPriority()`
`int` | `getUnlockTimeout()`
`protected JIoEndpoint.Worker` | `getWorkerThread()` Return a new worker thread, and block while to worker is available.
`void` | `init()`
`boolean` | `isPaused()`
`boolean` | `isRunning()`
`protected JIoEndpoint.Worker` | `newWorkerThread()` Create and return a new processor suitable for processing HTTP requests and returning the corresponding responses.
`void` | `pause()`
`protected boolean` | `processSocket(java.net.Socket socket)` Process given socket.
`protected void` | `recycleWorkerThread(JIoEndpoint.Worker workerThread)` Recycle the specified Processor so that it can be used again.
`void` | `resume()`
`void` | `setAcceptorThreadCount(int acceptorThreadCount)`
`void` | `setAddress(java.net.InetAddress address)`
`void` | `setBacklog(int backlog)`
`void` | `setDaemon(boolean b)`
`void` | `setExecutor(java.util.concurrent.Executor executor)`
`void` | `setHandler(JIoEndpoint.Handler handler)`
`void` | `setMaxThreads(int maxThreads)`
`void` | `setName(java.lang.String name)`
`void` | `setPort(int port)`
`void` | `setServerSocketFactory(ServerSocketFactory factory)`
`protected boolean` | `setSocketOptions(java.net.Socket socket)` Set the options for the current socket.
`void` | `setSoLinger(int soLinger)`
`void` | `setSoTimeout(int soTimeout)`
`void` | `setTcpNoDelay(boolean tcpNoDelay)`
`void` | `setThreadPriority(int threadPriority)`
`void` | `setUnlockTimeout(int unlockTimeout)`
`void` | `start()`
`void` | `stop()`
`protected void` | `unlockAccept()` Unlock the accept by using a local connection.

Methods inherited from class org.apache.tomcat.util.net.AbstractEndpoint
`getMaxHeaderCount, setMaxHeaderCount`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected static Log log

### sm

    protected StringManager sm

### CIPHER_SUITE_KEY

    public static final java.lang.String CIPHER_SUITE_KEY

  The Request attribute key for the cipher suite.

  See Also:
    Constant Field Values

### KEY_SIZE_KEY

    public static final java.lang.String KEY_SIZE_KEY

  The Request attribute key for the key size.

  See Also:
    Constant Field Values

### CERTIFICATE_KEY

    public static final java.lang.String CERTIFICATE_KEY

  The Request attribute key for the client certificate chain.

  See Also:
    Constant Field Values

### SESSION_ID_KEY

    public static final java.lang.String SESSION_ID_KEY

  The Request attribute key for the session id. This one is a Tomcat extension to the Servlet spec.

  See Also:
    Constant Field Values

### workers

    protected JIoEndpoint.WorkerStack workers

  Available workers.

### running

    protected volatile boolean running

  Running state of the endpoint.

### paused

    protected volatile boolean paused

  Will be set to true whenever the endpoint is paused.

### initialized

    protected boolean initialized

  Track the initialization state of the endpoint.

### curThreadsBusy

    protected int curThreadsBusy

  Current worker threads busy count.

### curThreads

    protected int curThreads

  Current worker threads count.

### sequence

    protected int sequence

  Sequence number used to generate thread names.

### serverSocket

    protected java.net.ServerSocket serverSocket

  Associated server socket.

### acceptorThreadCount

    protected int acceptorThreadCount

  Acceptor thread count.

### executor

    protected java.util.concurrent.Executor executor

  External Executor based thread pool.

### maxThreads

    protected int maxThreads

  Maximum amount of worker threads.

### threadPriority

    protected int threadPriority

  Priority of the acceptor and poller threads.

### port

    protected int port

  Server socket port.

### address

    protected java.net.InetAddress address

  Address for the server socket.

### handler

    protected JIoEndpoint.Handler handler

  Handling of accepted sockets.

### backlog

    protected int backlog

  Allows the server developer to specify the backlog that should be used for server sockets. By default, this value is 100.

### tcpNoDelay

    protected boolean tcpNoDelay

  Socket TCP no delay.

### soLinger

    protected int soLinger

  Socket linger.

### soTimeout

    protected int soTimeout

  Socket timeout.

### daemon

    protected boolean daemon

  The default is true - the created threads will be in daemon mode. If set to false, the control thread will not be daemon - and will keep the process alive.

### name

    protected java.lang.String name

  Name of the thread pool, which will be used for naming child threads.

### serverSocketFactory

    protected ServerSocketFactory serverSocketFactory

  Server socket factory.

### unlockTimeout

    protected int unlockTimeout

  Unlock timeout.

Constructor Detail

### JIoEndpoint

    public JIoEndpoint()

Method Detail

### setAcceptorThreadCount

    public void setAcceptorThreadCount(int acceptorThreadCount)

### getAcceptorThreadCount

    public int getAcceptorThreadCount()

### setExecutor

    public void setExecutor(java.util.concurrent.Executor executor)

### getExecutor

    public java.util.concurrent.Executor getExecutor()

### setMaxThreads

    public void setMaxThreads(int maxThreads)

### getMaxThreads

    public int getMaxThreads()

### setThreadPriority

    public void setThreadPriority(int threadPriority)

### getThreadPriority

    public int getThreadPriority()

### getPort

    public int getPort()

### setPort

    public void setPort(int port)

### getAddress

    public java.net.InetAddress getAddress()

### setAddress

    public void setAddress(java.net.InetAddress address)

### setHandler

    public void setHandler(JIoEndpoint.Handler handler)

### getHandler

    public JIoEndpoint.Handler getHandler()

### setBacklog

    public void setBacklog(int backlog)

### getBacklog

    public int getBacklog()

### getTcpNoDelay

    public boolean getTcpNoDelay()

### setTcpNoDelay

    public void setTcpNoDelay(boolean tcpNoDelay)

### getSoLinger

    public int getSoLinger()

### setSoLinger

    public void setSoLinger(int soLinger)

### getSoTimeout

    public int getSoTimeout()

### setSoTimeout

    public void setSoTimeout(int soTimeout)

### setDaemon

    public void setDaemon(boolean b)

### getDaemon

    public boolean getDaemon()

### setName

    public void setName(java.lang.String name)

### getName

    public java.lang.String getName()

### setServerSocketFactory

    public void setServerSocketFactory(ServerSocketFactory factory)

### getServerSocketFactory

    public ServerSocketFactory getServerSocketFactory()

### getUnlockTimeout

    public int getUnlockTimeout()

### setUnlockTimeout

    public void setUnlockTimeout(int unlockTimeout)

### getLocalPort

    public int getLocalPort()

  Port in use.

  Specified by:
    `getLocalPort` in class `AbstractEndpoint`

### isRunning

    public boolean isRunning()

### isPaused

    public boolean isPaused()

### getCurrentThreadCount

    public int getCurrentThreadCount()

  Return the amount of threads that are managed by the pool.

  Returns:
    the amount of threads that are managed by the pool

### getCurrentThreadsBusy

    public int getCurrentThreadsBusy()

  Return the amount of threads that are in use

  Returns:
    the amount of threads that are in use

### init

    public void init()
              throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### start

    public void start()
               throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### pause

    public void pause()

### resume

    public void resume()

### stop

    public void stop()

### destroy

    public void destroy()
                 throws java.lang.Exception

  Deallocate APR memory pools, and close server socket.

  Throws:
    `java.lang.Exception`

### unlockAccept

    protected void unlockAccept()

  Unlock the accept by using a local connection.

### setSocketOptions

    protected boolean setSocketOptions(java.net.Socket socket)

  Set the options for the current socket.

### createWorkerThread

    protected JIoEndpoint.Worker createWorkerThread()

  Create (or allocate) and return an available processor for use in processing a specific HTTP request, if possible. If the maximum allowed processors have already been created and are in use, return `null` instead.

### newWorkerThread

    protected JIoEndpoint.Worker newWorkerThread()

  Create and return a new processor suitable for processing HTTP requests and returning the corresponding responses.

### getWorkerThread

    protected JIoEndpoint.Worker getWorkerThread()

  Return a new worker thread, and block while to worker is available.

### recycleWorkerThread

    protected void recycleWorkerThread(JIoEndpoint.Worker workerThread)

  Recycle the specified Processor so that it can be used again.

  Parameters:
    `workerThread` - The processor to be recycled

### processSocket

    protected boolean processSocket(java.net.Socket socket)

  Process given socket.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 6.0.51
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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