|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ow2.jonas.lib.management.javaee.ManagedObject org.ow2.jonas.workmanager.internal.JWorkManager
public class JWorkManager
Jonas Implementation of the Resource Work Manager
Field Summary | |
---|---|
protected static long |
FEW_MORE_SECONDS
|
protected int |
freeThreads
|
protected int |
maxpoolsz
|
protected int |
minpoolsz
|
protected static int |
poolnumber
|
protected int |
poolsz
|
static String |
SERVICE_NAME
Name as used to label configuration properties. |
protected static int |
threadnumber
|
protected boolean |
valid
|
protected long |
waitingTime
|
protected List |
workList
|
Fields inherited from interface javax.resource.spi.work.WorkManager |
---|
IMMEDIATE, INDEFINITE, UNKNOWN |
Constructor Summary | |
---|---|
JWorkManager(int minsz,
int maxsz,
TransactionService transactionService,
long threadwait)
Constructor |
Method Summary | |
---|---|
void |
doWork(Work work)
Accepts a Work instance for processing. |
void |
doWork(Work work,
long timeout,
ExecutionContext ectx,
WorkListener listener)
Accepts a Work instance for processing. |
int |
getCurrentPoolSize()
|
int |
getMaxPoolSize()
|
int |
getMinPoolSize()
|
protected long |
getSequenceNumber()
Return a sequence number and increase this number. |
void |
nextWork()
Get the next JWork object to be run. |
void |
saveConfig()
Save updated configuration. |
void |
scheduleWork(Work work)
Accepts a Work instance for processing. |
void |
scheduleWork(Work work,
long timeout,
ExecutionContext ectx,
WorkListener listener)
Accepts a Work instance for processing. |
void |
setMaxPoolSize(int maxsz)
Set the max pool size |
void |
setMinPoolSize(int minsz)
Set the min pool size |
long |
startWork(Work work)
Accepts a Work instance for processing. |
long |
startWork(Work work,
long timeout,
ExecutionContext ectx,
WorkListener listener)
Accepts a Work instance for processing. |
void |
stopThreads()
Remove this WorkManager : Stop all threads |
Methods inherited from class org.ow2.jonas.lib.management.javaee.ManagedObject |
---|
sendNotification, sendReconfigNotification, sendSaveNotification, setModelMBean |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SERVICE_NAME
protected List workList
protected static int poolnumber
protected static int threadnumber
protected int maxpoolsz
protected int minpoolsz
protected int poolsz
protected int freeThreads
protected long waitingTime
protected boolean valid
protected static final long FEW_MORE_SECONDS
Constructor Detail |
---|
public JWorkManager(int minsz, int maxsz, TransactionService transactionService, long threadwait)
threadwait
- max time in seconds a thread will waitMethod Detail |
---|
public int getCurrentPoolSize()
public int getMinPoolSize()
public int getMaxPoolSize()
public void setMinPoolSize(int minsz)
minsz
- public void setMaxPoolSize(int maxsz)
maxsz
- public void saveConfig()
protected long getSequenceNumber()
public void doWork(Work work) throws WorkException
doWork
in interface WorkManager
work
- The unit of work to be done. Could be long or short-lived.
WorkRejectedException
- a Work instance has been rejected from further processing.
WorkCompletedException
- a Work instance has completed execution with an exception.
WorkException
public void doWork(Work work, long timeout, ExecutionContext ectx, WorkListener listener) throws WorkException
doWork
in interface WorkManager
work
- The unit of work to be done. Could be long or short-lived.timeout
- a time duration (in milliseconds) within which the
execution of the Work instance must start. Otherwise, the Work
instance is rejected with a WorkRejectedException set to an
appropriate error code (WorkRejectedException.TIMED_OUT).ectx
- an object containing the execution context with which the
submitted Work instance must be executed.listener
- an object which would be notified when the various Work
processing events (work accepted, work rejected, work started,
work completed) occur.
WorkRejectedException
- a Work instance has been rejected from
further processing.
WorkCompletedException
- a Work instance has completed execution
with an exception.
WorkException
public long startWork(Work work) throws WorkException
startWork
in interface WorkManager
work
- The unit of work to be done. Could be long or short-lived.
WorkRejectedException
- a Work instance has been rejected from
further processing.
WorkException
public long startWork(Work work, long timeout, ExecutionContext ectx, WorkListener listener) throws WorkException
startWork
in interface WorkManager
work
- The unit of work to be done. Could be long or short-lived.timeout
- a time duration (in milliseconds) within which the
execution of the Work instance must start. Otherwise, the Work
instance is rejected with a WorkRejectedException set to an
appropriate error code (WorkRejectedException.TIMED_OUT).ectx
- an object containing the execution context with which the
submitted Work instance must be executed.listener
- an object which would be notified when the various Work
processing events (work accepted, work rejected, work started,
work completed) occur.
WorkRejectedException
- a Work instance has been rejected from
further processing.
WorkException
public void scheduleWork(Work work) throws WorkException
scheduleWork
in interface WorkManager
work
- The unit of work to be done. Could be long or short-lived.timeout
- a time duration (in milliseconds) within which the
execution of the Work instance must start. Otherwise, the Work
instance is rejected with a WorkRejectedException set to an
appropriate error code (WorkRejectedException.TIMED_OUT).ectx
- an object containing the execution context with which the
submitted Work instance must be executed.listener
- an object which would be notified when the various Work
processing events (work accepted, work rejected, work started,
work completed) occur.
WorkRejectedException
- a Work instance has been rejected from
further processing.
WorkException
public void scheduleWork(Work work, long timeout, ExecutionContext ectx, WorkListener listener) throws WorkException
scheduleWork
in interface WorkManager
work
- The unit of work to be done. Could be long or short-lived.timeout
- a time duration (in milliseconds) within which the
execution of the Work instance must start. Otherwise, the Work
instance is rejected with a WorkRejectedException set to an
appropriate error code (WorkRejectedException.TIMED_OUT).ectx
- an object containing the execution context with which the
submitted Work instance must be executed.listener
- an object which would be notified when the various Work
processing events (work accepted, work rejected, work started,
work completed) occur.
WorkRejectedException
- a Work instance has been rejected from
further processing.
WorkException
public void nextWork() throws WorkException, InterruptedException
WorkException
InterruptedException
public void stopThreads()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |