de.esprit.netsuite.server.chreq

## Class RequestServiceThreadPool

- java.lang.Object
- - java.util.concurrent.AbstractExecutorService
  - - java.util.concurrent.ThreadPoolExecutor
    - - de.esprit.netsuite.common.AbstractThreadPool
      - - de.esprit.netsuite.server.cpu.ServerThreadPool
        - - de.esprit.netsuite.server.chreq.RequestServiceThreadPool

- All Implemented Interfaces:
    Dumpable, ServerObject, java.util.concurrent.Executor, java.util.concurrent.ExecutorService

      public class RequestServiceThreadPool
      extends ServerThreadPool

  This thread pool uses cached threads in order to forward a request to a particular RequestHandler. If the response does not appear within the request-timeout, a response with a TimeoutException is returned. This pool is limited because NOT too many requests should run in parallel. If more requests than the core-pool size want to run they are just queued. If the queue is full, more threads are started until the max-pool size is reached. Any further request will be rejected by issuing a ServerTooBusyException.
  Author:
    Rainer Buesch

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor

      `java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RequestServiceThreadPool(ServerContext serverCtx)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `afterExecute(java.lang.Runnable r, java.lang.Throwable t)`
    `protected void` | `beforeExecute(java.lang.Thread t, java.lang.Runnable r)`
    `protected java.util.concurrent.ThreadFactory` | `createThreadFactory()`
    `NetResponse` | `handleRequest(RequestHandler handler, NetRequest request, NetResponse response)`
    `void` | `setCorePoolSize(int poolSize)` Ensure that the max-poolsize is always the same as the core-poolsize
    `void` | `setMaximumPoolSize(int poolSize)` Ensure that the max-poolsize is always the same as the core-poolsize

    - ### Methods inherited from class de.esprit.netsuite.server.cpu.ServerThreadPool

      `getServerContext, getServerStatistic, sendErrorMail`

    - ### Methods inherited from class de.esprit.netsuite.common.AbstractThreadPool

      `toDumpString, toDumpString, toString, toString`

    - ### Methods inherited from class java.util.concurrent.ThreadPoolExecutor

      `allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setKeepAliveTime, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated`

    - ### Methods inherited from class java.util.concurrent.AbstractExecutorService

      `invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### RequestServiceThreadPool

          public RequestServiceThreadPool(ServerContext serverCtx)

  - ### Method Detail

    - #### setCorePoolSize

          public void setCorePoolSize(int poolSize)

      Ensure that the max-poolsize is always the same as the core-poolsize
      Overrides:
        `setCorePoolSize` in class `java.util.concurrent.ThreadPoolExecutor`

    - #### setMaximumPoolSize

          public void setMaximumPoolSize(int poolSize)

      Ensure that the max-poolsize is always the same as the core-poolsize
      Overrides:
        `setMaximumPoolSize` in class `java.util.concurrent.ThreadPoolExecutor`

    - #### handleRequest

          public NetResponse handleRequest(RequestHandler handler,
                                  NetRequest request,
                                  NetResponse response)

    - #### afterExecute

          protected void afterExecute(java.lang.Runnable r,
                          java.lang.Throwable t)

      Overrides:
        `afterExecute` in class `AbstractThreadPool`

    - #### beforeExecute

          protected void beforeExecute(java.lang.Thread t,
                           java.lang.Runnable r)

      Overrides:
        `beforeExecute` in class `java.util.concurrent.ThreadPoolExecutor`

    - #### createThreadFactory

          protected java.util.concurrent.ThreadFactory createThreadFactory()

      Specified by:
        `createThreadFactory` in class `AbstractThreadPool`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.