Top Description Inners Methods
org.eclipse.jetty.util.thread

public Interface ThreadPool

extends Executor
Known Direct Subinterfaces
org.eclipse.jetty.util.thread.ThreadPool.SizedThreadPool
Annotations
@ManagedObject:Pool of Threads
Imports
java.util.concurrent.Executor, org.eclipse.jetty.util.annotation.ManagedAttribute, .ManagedObject, org.eclipse.jetty.util.component.LifeCycle

A pool for threads.

A specialization of Executor interface that provides reporting methods (eg getThreads()) and the option of configuration methods (e.g. @link SizedThreadPool#setMaxThreads(int)).

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ThreadPool.SizedThreadPool

Specialized sub-interface of ThreadPool that allows to get/set the minimum and maximum number of threads of the pool.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The number of idle threads in the pool
getIdleThreads
()

public int

Returns:

The total number of threads currently in the pool
getThreads
()

public boolean

Returns:

True if the pool is low on threads
isLowOnThreads
()

public void
join()

Blocks until the thread pool is stopped.

Inherited from java.util.concurrent.Executor:
execute

Method Detail

getIdleThreadsback to summary
public int getIdleThreads()
Returns:int

The number of idle threads in the pool

Annotations
@ManagedAttribute:number of idle threads in pool
getThreadsback to summary
public int getThreads()
Returns:int

The total number of threads currently in the pool

Annotations
@ManagedAttribute:number of threads in pool
isLowOnThreadsback to summary
public boolean isLowOnThreads()
Returns:boolean

True if the pool is low on threads

Annotations
@ManagedAttribute:indicates the pool is low on available threads
joinback to summary
public void join() throws InterruptedException

Blocks until the thread pool is stopped.

Exceptions
InterruptedException:
if thread was interrupted
org.eclipse.jetty.util.thread back to summary

public Interface ThreadPool.SizedThreadPool

extends ThreadPool
Known Direct Implementers
org.eclipse.jetty.util.thread.ExecutorThreadPool, org.eclipse.jetty.util.thread.QueuedThreadPool

Specialized sub-interface of ThreadPool that allows to get/set the minimum and maximum number of threads of the pool.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the maximum number of threads
getMaxThreads
()

public int

Returns:

the minimum number of threads
getMinThreads
()

public default ThreadPoolBudget

Returns:

a ThreadPoolBudget for this sized thread pool, or null of no ThreadPoolBudget can be returned
getThreadPoolBudget
()

public void
setMaxThreads(int
the maximum number of threads
threads
)

public void
setMinThreads(int
the minimum number of threads
threads
)

Inherited from org.eclipse.jetty.util.thread.ThreadPool:
getIdleThreadsgetThreadsisLowOnThreadsjoin

Method Detail

getMaxThreadsback to summary
public int getMaxThreads()
Returns:int

the maximum number of threads

getMinThreadsback to summary
public int getMinThreads()
Returns:int

the minimum number of threads

getThreadPoolBudgetback to summary
public default ThreadPoolBudget getThreadPoolBudget()
Returns:ThreadPoolBudget

a ThreadPoolBudget for this sized thread pool, or null of no ThreadPoolBudget can be returned

setMaxThreadsback to summary
public void setMaxThreads(int threads)
Parameters
threads:int

the maximum number of threads

setMinThreadsback to summary
public void setMinThreads(int threads)
Parameters
threads:int

the minimum number of threads