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

## org.eclipse.jetty.util.thread
Class ExecutorThreadPool

    java.lang.Object
      org.eclipse.jetty.util.component.AbstractLifeCycle
          org.eclipse.jetty.util.thread.ExecutorThreadPool

All Implemented Interfaces:
  LifeCycle, ThreadPool

    public class ExecutorThreadPool

extends AbstractLifeCycle
implements ThreadPool, LifeCycle

Jetty ThreadPool using java 5 ThreadPoolExecutor This class wraps a `ExecutorService` as a `ThreadPool` and `LifeCycle` interfaces so that it may be used by the Jetty `org.eclipse.jetty.server.Server`

Nested Class Summary

Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`AbstractLifeCycle.AbstractLifeCycleListener`

Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
`LifeCycle.Listener`

Field Summary

Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING`

Constructor Summary
`ExecutorThreadPool()` constructor.
`ExecutorThreadPool(java.util.concurrent.ExecutorService executor)`
`ExecutorThreadPool(int queueSize)` constructor.
`ExecutorThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime)` constructor.
`ExecutorThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit)` constructor.
`ExecutorThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)`

Method Summary
`boolean` | `dispatch(java.lang.Runnable job)`
`protected void` | `doStart()`
`protected void` | `doStop()`
`int` | `getIdleThreads()`
`int` | `getThreads()`
`boolean` | `isLowOnThreads()`
`void` | `join()` Blocks until the thread pool is `stopped`.

Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

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

Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
`addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

Constructor Detail

### ExecutorThreadPool

    public ExecutorThreadPool(java.util.concurrent.ExecutorService executor)

### ExecutorThreadPool

    public ExecutorThreadPool()

  constructor. Wraps an `ThreadPoolExecutor`. Core size is 32, max pool size is 256, pool thread timeout after 60 seconds and an unbounded `LinkedBlockingQueue` is used for the job queue;

### ExecutorThreadPool

    public ExecutorThreadPool(int queueSize)

  constructor. Wraps an `ThreadPoolExecutor`. Core size is 32, max pool size is 256, pool thread timeout after 60 seconds

  Parameters:
    `queueSize` - if -1, an unbounded `LinkedBlockingQueue` is used, if 0 then a `SynchronousQueue` is used, other a `ArrayBlockingQueue` of the given size is used.

### ExecutorThreadPool

    public ExecutorThreadPool(int corePoolSize,
                              int maximumPoolSize,
                              long keepAliveTime)

  constructor. Wraps an `ThreadPoolExecutor` using an unbounded `LinkedBlockingQueue` is used for the jobs queue;

### ExecutorThreadPool

    public ExecutorThreadPool(int corePoolSize,
                              int maximumPoolSize,
                              long keepAliveTime,
                              java.util.concurrent.TimeUnit unit)

  constructor. Wraps an `ThreadPoolExecutor` using an unbounded `LinkedBlockingQueue` is used for the jobs queue;

### ExecutorThreadPool

    public ExecutorThreadPool(int corePoolSize,
                              int maximumPoolSize,
                              long keepAliveTime,
                              java.util.concurrent.TimeUnit unit,
                              java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)

Method Detail

### dispatch

    public boolean dispatch(java.lang.Runnable job)

  Specified by:
    `dispatch` in interface `ThreadPool`

### getIdleThreads

    public int getIdleThreads()

  Specified by:
    `getIdleThreads` in interface `ThreadPool`
  Returns:
    The number of idle threads in the pool

### getThreads

    public int getThreads()

  Specified by:
    `getThreads` in interface `ThreadPool`
  Returns:
    The total number of threads currently in the pool

### isLowOnThreads

    public boolean isLowOnThreads()

  Specified by:
    `isLowOnThreads` in interface `ThreadPool`
  Returns:
    True if the pool is low on threads

### join

    public void join()
              throws java.lang.InterruptedException

  Description copied from interface: `ThreadPool`
  Blocks until the thread pool is `stopped`.

  Specified by:
    `join` in interface `ThreadPool`
  Throws:
    `java.lang.InterruptedException`

### doStart

    protected void doStart()
                    throws java.lang.Exception

  Overrides:
    `doStart` in class `AbstractLifeCycle`
  Throws:
    `java.lang.Exception`

### doStop

    protected void doStop()
                   throws java.lang.Exception

  Overrides:
    `doStop` in class `AbstractLifeCycle`
  Throws:
    `java.lang.Exception`

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

Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.