站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 jmx API Documentation 英文版文档

ThreadPool (JBoss/JMX API) - JBoss 4.0.1 sp1 jmx API Documentation 英文版文档


org.jboss.mx.util
Class ThreadPool

java.lang.Object
  extended byorg.jboss.mx.util.ThreadPool

public class ThreadPool
extends Object

A simple thread pool. Idle threads are cached for future use. The cache grows until it reaches a maximum size (default 10). When there is nothing in the cache, a new thread is created. By default the threads are daemon threads. Rickard 脰berg Adrian Brock

Version:
$Revision: 1.6 $

Constructor Summary
ThreadPool()
          Create a new pool.
ThreadPool(boolean active)
          Create a new pool with an activity status
 
Method Summary
 boolean getDaemonThreads()
          Get whether new threads are daemon threads.
 int getMaximumSize()
          Get the maximum number of idle threads cached in this pool.
 boolean isActive()
          Get the activity status of the pool.
 void run(Runnable work)
          Do some work.
 void setActive(boolean status)
          Set the activity status of the pool.
 void setDaemonThreads(boolean value)
          Set whether new threads are daemon threads.
 void setMaximumSize(int size)
          Set the maximum number of idle threads cached in this pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPool

public ThreadPool()
Create a new pool.


ThreadPool

public ThreadPool(boolean active)
Create a new pool with an activity status

Parameters:
active - true for active, false otherwise
Method Detail

setMaximumSize

public void setMaximumSize(int size)
Set the maximum number of idle threads cached in this pool.

Parameters:
size - the new maximum size.

getMaximumSize

public int getMaximumSize()
Get the maximum number of idle threads cached in this pool.

Returns:
the maximum size

setActive

public void setActive(boolean status)
Set the activity status of the pool. Setting the pool to inactive, clears the pool.

Parameters:
status - pass true for active, false otherwise.

isActive

public boolean isActive()
Get the activity status of the pool.

Returns:
true for an active pool, false otherwise.

setDaemonThreads

public void setDaemonThreads(boolean value)
Set whether new threads are daemon threads.

Parameters:
value - pass true for daemon threads, false otherwise.

getDaemonThreads

public boolean getDaemonThreads()
Get whether new threads are daemon threads.

Returns:
true for daemon threads, false otherwise.

run

public void run(Runnable work)
Do some work. This will either create a new thread to do the work, or use an existing idle cached thread.

Parameters:
work - the work to perform.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.