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

ThreadManagerImpl (JBoss Aspects API) - JBoss 4.0.1 sp1 aspects API Documentation 英文版文档


org.jboss.aspects.asynchronous.concurrent
Class ThreadManagerImpl

java.lang.Object
  extended byEDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
      extended byorg.jboss.aspects.asynchronous.concurrent.ThreadManagerImpl
All Implemented Interfaces:
AsynchronousConstants, ThreadManager

public class ThreadManagerImpl
extends EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
implements AsynchronousConstants, ThreadManager

Version:
$Revision: 1.3 $
Author:
{Claude Hussenet Independent Consultant}.

Nested Class Summary
 
Nested classes inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser.DefaultThreadFactory
 
Field Summary
protected  EDU.oswego.cs.dl.util.concurrent.PooledExecutor _pooledExecutor
           
protected  boolean isPooling
           
protected  boolean waitWhenPoolSizeIsFull
           
 
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
threadFactory_
 
Fields inherited from interface org.jboss.aspects.asynchronous.AsynchronousConstants
CAN_NOT_PROCESS, EXCEPTIONCAUGHT, INTERRUPTED, INVOCATION, NOVALUE, OK, TIMEOUT, UNKNOWN
 
Constructor Summary
ThreadManagerImpl()
          Create a new pool with all default settings
ThreadManagerImpl(int maximumPoolSize)
          Create a new pool with all default settings except

for maximum pool size.

 
Method Summary
 long getKeepAliveTime()
          Return the number of milliseconds to keep threads alive waiting

for new commands.

 int getMaximumPoolSize()
          Return the maximum number of threads to simultaneously execute
 int getMinimumPoolSize()
          Return the minimum number of threads to simultaneously execute.
 long getPoolSize()
          Return the current number of active threads in the pool.
 boolean getWaitWhenPoolSizeIsFull()
          return the policy when the pool is full
 boolean isPooling()
           
 AsynchronousTask process(ThreadManagerRequest ppmRequest)
          Create, start and return a new asynchronous task from

 void setKeepAliveTime(long time)
          Set the number of milliseconds to keep threads alive waiting for

new commands.

 void setMaximumPoolSize(int maximumPoolSize)
          Set the minimum number of threads to use.
 void setMinimumPoolSize(int minimumPoolSize)
          Set the minimum number of threads to use.
 void setPooling(boolean isPooling)
           
 void setWaitWhenPoolSizeIsFull(boolean value)
          Set the policy for blocked execution to be to wait until a thread

is available.

 ThreadManagerResponse waitForResponse(AsynchronousTask input)
          Return the response from an asynchronous task

The call returns within the timeout defined

in the process method

 ThreadManagerResponse[] waitForResponses(AsynchronousTask[] inputImpl)
          Return an array of responses from an array of asynchronous task

The call returns within the maximum timeout from the array of tasks

 
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
getThreadFactory, setThreadFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_pooledExecutor

protected EDU.oswego.cs.dl.util.concurrent.PooledExecutor _pooledExecutor

waitWhenPoolSizeIsFull

protected boolean waitWhenPoolSizeIsFull

isPooling

protected boolean isPooling
Constructor Detail

ThreadManagerImpl

public ThreadManagerImpl()
Create a new pool with all default settings


ThreadManagerImpl

public ThreadManagerImpl(int maximumPoolSize)
Create a new pool with all default settings except

for maximum pool size.

Method Detail

setMaximumPoolSize

public void setMaximumPoolSize(int maximumPoolSize)
Set the minimum number of threads to use.

Specified by:
setMaximumPoolSize in interface ThreadManager
Throws:
IllegalArgumentException - if less than zero. (It is not

considered an error to set the minimum to be greater than the

maximum. However, in this case there are no guarantees about

behavior.)


setWaitWhenPoolSizeIsFull

public void setWaitWhenPoolSizeIsFull(boolean value)
Set the policy for blocked execution to be to wait until a thread

is available.

OR

Set the policy for blocked execution to be to

throw a RuntimeException.

Specified by:
setWaitWhenPoolSizeIsFull in interface ThreadManager

getWaitWhenPoolSizeIsFull

public boolean getWaitWhenPoolSizeIsFull()
return the policy when the pool is full

Specified by:
getWaitWhenPoolSizeIsFull in interface ThreadManager

getMaximumPoolSize

public int getMaximumPoolSize()
Return the maximum number of threads to simultaneously execute

Specified by:
getMaximumPoolSize in interface ThreadManager

setMinimumPoolSize

public void setMinimumPoolSize(int minimumPoolSize)
Set the minimum number of threads to use.

Specified by:
setMinimumPoolSize in interface ThreadManager
Throws:
IllegalArgumentException - if less than zero. (It is not

considered an error to set the minimum to be greater than the

maximum. However, in this case there are no guarantees about

behavior.)


getMinimumPoolSize

public int getMinimumPoolSize()
Return the minimum number of threads to simultaneously execute.

(Default value is 1). If fewer than the mininum number are

running upon reception of a new request, a new thread is started

to handle this request.

Specified by:
getMinimumPoolSize in interface ThreadManager

setKeepAliveTime

public void setKeepAliveTime(long time)
Set the number of milliseconds to keep threads alive waiting for

new commands. A negative value means to wait forever. A zero

value means not to wait at all.

Specified by:
setKeepAliveTime in interface ThreadManager

getKeepAliveTime

public long getKeepAliveTime()
Return the number of milliseconds to keep threads alive waiting

for new commands. A negative value means to wait forever. A zero

value means not to wait at all.

Specified by:
getKeepAliveTime in interface ThreadManager

getPoolSize

public long getPoolSize()
Return the current number of active threads in the pool. This

number is just a snaphot, and may change immediately upon

returning

Specified by:
getPoolSize in interface ThreadManager

waitForResponse

public ThreadManagerResponse waitForResponse(AsynchronousTask input)
Return the response from an asynchronous task

The call returns within the timeout defined

in the process method

Specified by:
waitForResponse in interface ThreadManager

waitForResponses

public ThreadManagerResponse[] waitForResponses(AsynchronousTask[] inputImpl)
Return an array of responses from an array of asynchronous task

The call returns within the maximum timeout from the array of tasks

Specified by:
waitForResponses in interface ThreadManager

process

public AsynchronousTask process(ThreadManagerRequest ppmRequest)
Description copied from interface: ThreadManager
Create, start and return a new asynchronous task from

ppmRequest class instance defining the task parameters.

Specified by:
process in interface ThreadManager

isPooling

public boolean isPooling()
Specified by:
isPooling in interface ThreadManager

setPooling

public void setPooling(boolean isPooling)
Specified by:
setPooling in interface ThreadManager


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