|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.continuent.tungsten.common.concurrent.SimpleJobService<V>
public class SimpleJobService<V>
This class implements a wrapper around the Java ExecutorService interface to present a simplified interface for spawning and managing tasks. Tasks submitted to the service return a particular type, which is used to parameterize this class.
| Constructor Summary | |
|---|---|
SimpleJobService(java.lang.String name,
int maxThreads,
int maxRequests,
int keepAlive)
Creates the job service. |
|
| Method Summary | |
|---|---|
int |
getActiveTaskCount()
Returns the number of tasks that are currently executing. |
int |
getPendingTaskCount()
Returns the number of tasks that are submitted and awaiting execution. |
void |
shutdown()
Shut down the job service by letting current tasks run to completion but accepting no further tasks. |
void |
shutdownNow()
Shut down the job service immediately. |
java.util.concurrent.Future<V> |
submit(java.util.concurrent.Callable<V> task)
Submits a task for execution. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleJobService(java.lang.String name,
int maxThreads,
int maxRequests,
int keepAlive)
name - Name of this service, which will be prefixed to threadsmaxThreads - Maximum number of threads in the pool; must be at least
1maxRequests - Maximum number of pending requests; must be at least 1keepAlive - Number of seconds to retain unused threads| Method Detail |
|---|
public java.util.concurrent.Future<V> submit(java.util.concurrent.Callable<V> task)
throws java.util.concurrent.RejectedExecutionException
java.util.concurrent.RejectedExecutionException - Thrown if the task cannot be
submitted, typically because the request queue is fullpublic int getPendingTaskCount()
public int getActiveTaskCount()
public void shutdown()
public void shutdownNow()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||