|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exoplatform.services.threadpool.impl.ThreadPoolServiceImpl
@Deprecated public class ThreadPoolServiceImpl
| Nested Class Summary | |
|---|---|
protected static interface |
ThreadPoolServiceImpl.BlockedExecutionStrategy
Deprecated. Class for actions to take when execute() blocks. |
protected class |
ThreadPoolServiceImpl.DiscardWhenBlocked
Deprecated. Class defining Discard action * |
protected class |
ThreadPoolServiceImpl.RunWhenBlocked
Deprecated. Class defining Run action * |
protected class |
ThreadPoolServiceImpl.WaitWhenBlocked
Deprecated. Class defining Wait action * |
protected class |
ThreadPoolServiceImpl.Worker
Deprecated. Class defining the basic run loop for pooled threads. |
| Field Summary | |
|---|---|
protected ThreadPoolServiceImpl.BlockedExecutionStrategy |
blockedExecutionStrategy
Deprecated. The current strategy * |
static long |
DEFAULT_MAXIDLETIME
Deprecated. The maximum time to keep worker threads alive waiting for new tasks; used if not otherwise specified. |
static int |
DEFAULT_MAXIMUMPOOLSIZE
Deprecated. The maximum pool size; used if not otherwise specified. |
static int |
DEFAULT_NORMALPOOLSIZE
Deprecated. The normal pool size; used if not otherwise specified. |
protected Queue |
handOff
Deprecated. |
protected long |
maxIdleTime
Deprecated. |
protected int |
maximumPoolSize
Deprecated. |
protected int |
normalPoolSize
Deprecated. |
protected java.lang.Object |
poolLock
Deprecated. Lock used for protecting poolSize and threads map * |
protected int |
poolSize
Deprecated. Current pool size. |
protected java.util.Map |
threads
Deprecated. An object to map active worker objects to their active thread. |
| Constructor Summary | |
|---|---|
ThreadPoolServiceImpl(LogService logService)
Deprecated. Construct a new pool with all default settings |
|
| Method Summary | |
|---|---|
protected void |
addThread(java.lang.Runnable task)
Deprecated. Create and start a thread to handle a new task. |
int |
createThreads(int numberOfThreads)
Deprecated. Create and start up to numberOfThreads threads in the pool. |
void |
discardWhenBlocked()
Deprecated. Set the policy for blocked execution to be to return without executing the request |
java.util.List |
drain()
Deprecated. Remove all unprocessed tasks from pool queue, and return them in a java.util.List. |
void |
execute(java.lang.Runnable task)
Deprecated. Arrange for the given task to be executed by a thread in this pool. |
protected ThreadPoolServiceImpl.BlockedExecutionStrategy |
getBlockedExecutionStrategy()
Deprecated. Get the strategy for blocked execution * |
long |
getMaxIdleTime()
Deprecated. Return the number of milliseconds to keep threads alive waiting for new tasks. |
int |
getMaximumPoolSize()
Deprecated. Return the maximum number of threads to simultaneously execute New requests are handled according to the current blocking policy once this limit is exceeded. |
int |
getNormalPoolSize()
Deprecated. Return the normal number of threads to simultaneously execute. |
int |
getPoolSize()
Deprecated. Return the current number of active threads in the pool. |
protected java.lang.Runnable |
getTask()
Deprecated. get a task from the handoff queue * |
protected ThreadFactoryIF |
getThreadFactory()
Deprecated. Return the current thread factory object. |
void |
interruptAll()
Deprecated. Interrupt all threads in the pool, causing them all to terminate. |
void |
runWhenBlocked()
Deprecated. Set the policy for blocked execution to be that the current thread executes the task if there are no available threads in the pool. |
void |
setMaxIdleTime(long msecs)
Deprecated. Set the number of milliseconds to keep threads alive waiting for new tasks. |
void |
setMaximumPoolSize(int newMaximum)
Deprecated. Set the maximum number of threads to use. |
void |
setNormalPoolSize(int newNormal)
Deprecated. Set the normal number of threads to use. |
void |
setThreadFactory(ThreadFactoryIF newValue)
Deprecated. Set the object that will be used to create threads. |
void |
WhenBlocked()
Deprecated. Set the policy for blocked execution to be to wait until a thread is available. |
protected void |
workerDone(ThreadPoolServiceImpl.Worker w)
Deprecated. Called upon termination of worker thread * |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_MAXIMUMPOOLSIZE
public static final int DEFAULT_NORMALPOOLSIZE
public static final long DEFAULT_MAXIDLETIME
protected volatile int maximumPoolSize
protected volatile int normalPoolSize
protected long maxIdleTime
protected Queue handOff
protected java.lang.Object poolLock
protected volatile int poolSize
protected java.util.Map threads
protected ThreadPoolServiceImpl.BlockedExecutionStrategy blockedExecutionStrategy
| Constructor Detail |
|---|
public ThreadPoolServiceImpl(LogService logService)
| Method Detail |
|---|
public int getMaximumPoolSize()
public void setMaximumPoolSize(int newMaximum)
java.lang.IllegalArgumentException - if less or equal to zero. (It is not
considered an error to set the maximum to be less than than the
normal. However, in this case there are no guarantees about
behavior.)public int getNormalPoolSize()
public void setNormalPoolSize(int newNormal)
java.lang.IllegalArgumentException - if less than zero. (It is not considered
an error to set the normal to be greater than the maximum.
However, in this case there are no guarantees about behavior.)public int getPoolSize()
public void setThreadFactory(ThreadFactoryIF newValue)
protected ThreadFactoryIF getThreadFactory()
protected void addThread(java.lang.Runnable task)
public int createThreads(int numberOfThreads)
public void interruptAll()
public java.util.List drain()
List tasks = pool.drain(); for (Iterator it = tasks.iterator(); it.hasNext();) ((Runnable) (it.next())).run();
public long getMaxIdleTime()
public void setMaxIdleTime(long msecs)
protected void workerDone(ThreadPoolServiceImpl.Worker w)
protected java.lang.Runnable getTask()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionprotected ThreadPoolServiceImpl.BlockedExecutionStrategy getBlockedExecutionStrategy()
public void runWhenBlocked()
public void WhenBlocked()
public void discardWhenBlocked()
public void execute(java.lang.Runnable task)
throws java.lang.InterruptedException
execute in interface ThreadPoolServicejava.lang.InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||