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 QueuedThreadPool

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

All Implemented Interfaces:
  java.util.concurrent.Executor, LifeCycle, ThreadPool

    public class QueuedThreadPool

extends AbstractLifeCycle
implements ThreadPool, java.util.concurrent.Executor

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
`QueuedThreadPool()` Construct
`QueuedThreadPool(java.util.concurrent.BlockingQueue<java.lang.Runnable> jobQ)` Construct
`QueuedThreadPool(int maxThreads)` Construct

Method Summary
`boolean` | `dispatch(java.lang.Runnable job)`
`protected void` | `doStart()`
`protected void` | `doStop()`
`java.lang.String` | `dump()`
`java.lang.String` | `dumpThread(long id)`
`void` | `execute(java.lang.Runnable job)`
`int` | `getIdleThreads()`
`int` | `getMaxIdleTimeMs()` Get the maximum thread idle time.
`int` | `getMaxQueued()`
`int` | `getMaxStopTimeMs()`
`int` | `getMaxThreads()` Set the maximum number of threads.
`int` | `getMinThreads()` Get the minimum number of threads.
`java.lang.String` | `getName()`
`int` | `getThreads()`
`int` | `getThreadsPriority()` Get the priority of the pool threads.
`boolean` | `interruptThread(long id)`
`boolean` | `isDaemon()` Delegated to the named or anonymous Pool.
`boolean` | `isLowOnThreads()`
`void` | `join()` Blocks until the thread pool is `stopped`.
`protected java.lang.Thread` | `newThread(java.lang.Runnable runnable)`
`void` | `setDaemon(boolean daemon)` Delegated to the named or anonymous Pool.
`void` | `setMaxIdleTimeMs(int maxIdleTimeMs)` Set the maximum thread idle time.
`void` | `setMaxQueued(int max)`
`void` | `setMaxStopTimeMs(int stopTimeMs)`
`void` | `setMaxThreads(int maxThreads)` Set the maximum number of threads.
`void` | `setMinThreads(int minThreads)` Set the minimum number of threads.
`void` | `setName(java.lang.String name)`
`void` | `setThreadsPriority(int priority)` Set the priority of the pool threads.
`boolean` | `stopThread(long id)` Deprecated. Use `interruptThread(long)` in preference
`java.lang.String` | `toString()`

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, wait, wait, wait`

Constructor Detail

### QueuedThreadPool

    public QueuedThreadPool()

  Construct

### QueuedThreadPool

    public QueuedThreadPool(int maxThreads)

  Construct

### QueuedThreadPool

    public QueuedThreadPool(java.util.concurrent.BlockingQueue<java.lang.Runnable> jobQ)

  Construct

Method Detail

### 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`

### setDaemon

    public void setDaemon(boolean daemon)

  Delegated to the named or anonymous Pool.

### setMaxIdleTimeMs

    public void setMaxIdleTimeMs(int maxIdleTimeMs)

  Set the maximum thread idle time. Threads that are idle for longer than this period may be stopped. Delegated to the named or anonymous Pool.

  Parameters:
    `maxIdleTimeMs` - Max idle time in ms.
  See Also:
    `getMaxIdleTimeMs()`

### setMaxStopTimeMs

    public void setMaxStopTimeMs(int stopTimeMs)

  Parameters:
    `stopTimeMs` - maximum total time that stop() will wait for threads to die.

### setMaxThreads

    public void setMaxThreads(int maxThreads)

  Set the maximum number of threads. Delegated to the named or anonymous Pool.

  Parameters:
    `maxThreads` - maximum number of threads.
  See Also:
    `getMaxThreads()`

### setMinThreads

    public void setMinThreads(int minThreads)

  Set the minimum number of threads. Delegated to the named or anonymous Pool.

  Parameters:
    `minThreads` - minimum number of threads
  See Also:
    `getMinThreads()`

### setName

    public void setName(java.lang.String name)

  Parameters:
    `name` - Name of the BoundedThreadPool to use when naming Threads.

### setThreadsPriority

    public void setThreadsPriority(int priority)

  Set the priority of the pool threads.

  Parameters:
    `priority` - the new thread priority.

### getMaxQueued

    public int getMaxQueued()

  Returns:
    maximum queue size

### setMaxQueued

    public void setMaxQueued(int max)

  Parameters:
    `max` - job queue size

### getMaxIdleTimeMs

    public int getMaxIdleTimeMs()

  Get the maximum thread idle time. Delegated to the named or anonymous Pool.

  Returns:
    Max idle time in ms.
  See Also:
    `setMaxIdleTimeMs(int)`

### getMaxStopTimeMs

    public int getMaxStopTimeMs()

  Returns:
    maximum total time that stop() will wait for threads to die.

### getMaxThreads

    public int getMaxThreads()

  Set the maximum number of threads. Delegated to the named or anonymous Pool.

  Returns:
    maximum number of threads.
  See Also:
    `setMaxThreads(int)`

### getMinThreads

    public int getMinThreads()

  Get the minimum number of threads. Delegated to the named or anonymous Pool.

  Returns:
    minimum number of threads.
  See Also:
    `setMinThreads(int)`

### getName

    public java.lang.String getName()

  Returns:
    The name of the BoundedThreadPool.

### getThreadsPriority

    public int getThreadsPriority()

  Get the priority of the pool threads.

  Returns:
    the priority of the pool threads.

### isDaemon

    public boolean isDaemon()

  Delegated to the named or anonymous Pool.

### dispatch

    public boolean dispatch(java.lang.Runnable job)

  Specified by:
    `dispatch` in interface `ThreadPool`

### execute

    public void execute(java.lang.Runnable job)

  Specified by:
    `execute` in interface `java.util.concurrent.Executor`

### join

    public void join()
              throws java.lang.InterruptedException

  Blocks until the thread pool is `stopped`.

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

### getThreads

    public int getThreads()

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

### getIdleThreads

    public int getIdleThreads()

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

### isLowOnThreads

    public boolean isLowOnThreads()

  Specified by:
    `isLowOnThreads` in interface `ThreadPool`
  Returns:
    True if the pool is at maxThreads and there are more queued jobs than idle threads

### newThread

    protected java.lang.Thread newThread(java.lang.Runnable runnable)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### dump

    public java.lang.String dump()

### stopThread

    public boolean stopThread(long id)

  Deprecated. Use `interruptThread(long)` in preference

  Parameters:
    `id` - The thread ID to stop.
  Returns:
    true if the thread was found and stopped.

### interruptThread

    public boolean interruptThread(long id)

  Parameters:
    `id` - The thread ID to interrupt.
  Returns:
    true if the thread was found and interrupted.

### dumpThread

    public java.lang.String dumpThread(long id)

  Parameters:
    `id` - The thread ID to interrupt.
  Returns:
    true if the thread was found and interrupted.

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.