| java.lang.Object org.objectweb.jonas_lib.JWorkManager
JWorkManager | public class JWorkManager implements WorkManager(Code) | | Jonas Implementation of the Resource Work Manager
author: durieuxp |
Inner Class :class WorkThread extends Thread | |
Constructor Summary | |
public | JWorkManager(int minsz, int maxsz, TransactionManager tm, long threadwait) |
Method Summary | |
public void | doWork(Work work) Accepts a Work instance for processing.
This call blocks until the Work instance completes execution.
There is no guarantee on when the accepted Work instance would start execution ie.,
there is no time constraint to start execution.
Parameters: work - The unit of work to be done. | public void | doWork(Work work, long timeout, ExecutionContext ectx, WorkListener listener) Accepts a Work instance for processing. | public int | getCurrentPoolSize() | public int | getMaxPoolSize() | public int | getMinPoolSize() | public void | nextWork() Get the next JWork object to be run. | public void | scheduleWork(Work work) Accepts a Work instance for processing. | public void | scheduleWork(Work work, long timeout, ExecutionContext ectx, WorkListener listener) Accepts a Work instance for processing. | public void | setMaxPoolSize(int maxsz) | public void | setMinPoolSize(int minsz) | public long | startWork(Work work) Accepts a Work instance for processing. | public long | startWork(Work work, long timeout, ExecutionContext ectx, WorkListener listener) Accepts a Work instance for processing. | public synchronized void | stopThreads() |
FEW_MORE_SECONDS | final protected static long FEW_MORE_SECONDS(Code) | | |
freeThreads | protected int freeThreads(Code) | | |
maxpoolsz | protected int maxpoolsz(Code) | | |
minpoolsz | protected int minpoolsz(Code) | | |
poolnumber | protected static int poolnumber(Code) | | |
poolsz | protected int poolsz(Code) | | |
threadnumber | protected static int threadnumber(Code) | | |
valid | protected boolean valid(Code) | | |
waitingTime | protected long waitingTime(Code) | | |
JWorkManager | public JWorkManager(int minsz, int maxsz, TransactionManager tm, long threadwait)(Code) | | Constructor
Parameters: threadwait - max time in seconds a thread will wait |
doWork | public void doWork(Work work) throws WorkException(Code) | | Accepts a Work instance for processing.
This call blocks until the Work instance completes execution.
There is no guarantee on when the accepted Work instance would start execution ie.,
there is no time constraint to start execution.
Parameters: work - The unit of work to be done. Could be long or short-lived. throws: WorkRejectedException - a Work instance has been rejected from further processing. throws: WorkCompletedException - a Work instance has completed execution with an exception. throws: WorkException - |
doWork | public void doWork(Work work, long timeout, ExecutionContext ectx, WorkListener listener) throws WorkException(Code) | | Accepts a Work instance for processing. This call blocks until the Work
instance completes execution.
Parameters: work - The unit of work to be done. Could be long or short-lived. Parameters: timeout - a time duration (in milliseconds) within which theexecution of the Work instance must start. Otherwise, the Workinstance is rejected with a WorkRejectedException set to anappropriate error code (WorkRejectedException.TIMED_OUT). Parameters: ectx - an object containing the execution context with which thesubmitted Work instance must be executed. Parameters: listener - an object which would be notified when the various Workprocessing events (work accepted, work rejected, work started,work completed) occur. throws: WorkRejectedException - a Work instance has been rejected fromfurther processing. throws: WorkCompletedException - a Work instance has completed executionwith an exception. throws: WorkException - |
getCurrentPoolSize | public int getCurrentPoolSize()(Code) | | current pool size |
getMaxPoolSize | public int getMaxPoolSize()(Code) | | max pool size |
getMinPoolSize | public int getMinPoolSize()(Code) | | min pool size |
nextWork | public void nextWork() throws WorkException, InterruptedException(Code) | | Get the next JWork object to be run.
next JWork object to be run, or null if thread must end. |
scheduleWork | public void scheduleWork(Work work) throws WorkException(Code) | | Accepts a Work instance for processing. This call does not block and
returns immediately once a Work instance has been accepted for
processing. There is no guarantee on when the submitted Work instance
would start execution ie., there is no time constraint to start
execution.
Parameters: work - The unit of work to be done. Could be long or short-lived. Parameters: timeout - a time duration (in milliseconds) within which theexecution of the Work instance must start. Otherwise, the Workinstance is rejected with a WorkRejectedException set to anappropriate error code (WorkRejectedException.TIMED_OUT). Parameters: ectx - an object containing the execution context with which thesubmitted Work instance must be executed. Parameters: listener - an object which would be notified when the various Workprocessing events (work accepted, work rejected, work started,work completed) occur. throws: WorkRejectedException - a Work instance has been rejected fromfurther processing. throws: WorkException - |
scheduleWork | public void scheduleWork(Work work, long timeout, ExecutionContext ectx, WorkListener listener) throws WorkException(Code) | | Accepts a Work instance for processing. This call does not block and
returns immediately once a Work instance has been accepted for
processing. There is no guarantee on when the submitted Work instance
would start execution ie., there is no time constraint to start
execution.
Parameters: work - The unit of work to be done. Could be long or short-lived. Parameters: timeout - a time duration (in milliseconds) within which theexecution of the Work instance must start. Otherwise, the Workinstance is rejected with a WorkRejectedException set to anappropriate error code (WorkRejectedException.TIMED_OUT). Parameters: ectx - an object containing the execution context with which thesubmitted Work instance must be executed. Parameters: listener - an object which would be notified when the various Workprocessing events (work accepted, work rejected, work started,work completed) occur. throws: WorkRejectedException - a Work instance has been rejected fromfurther processing. throws: WorkException - |
setMaxPoolSize | public void setMaxPoolSize(int maxsz)(Code) | | Set the max pool size
Parameters: maxsz - |
setMinPoolSize | public void setMinPoolSize(int minsz)(Code) | | Set the min pool size
Parameters: minsz - |
startWork | public long startWork(Work work) throws WorkException(Code) | | Accepts a Work instance for processing. This call blocks until the Work
instance starts execution but not until its completion. There is no
guarantee on when the accepted Work instance would start execution ie.,
there is no time constraint to start execution.
Parameters: work - The unit of work to be done. Could be long or short-lived. the time elapsed (in milliseconds) from Work acceptance untilstart of execution. Note, this does not offer real-timeguarantees. It is valid to return -1, if the actual start delayduration is unknown. throws: WorkRejectedException - a Work instance has been rejected fromfurther processing. throws: WorkException - |
startWork | public long startWork(Work work, long timeout, ExecutionContext ectx, WorkListener listener) throws WorkException(Code) | | Accepts a Work instance for processing. This call blocks until the Work
instance starts execution but not until its completion. There is no
guarantee on when the accepted Work instance would start execution ie.,
there is no time constraint to start execution.
Parameters: work - The unit of work to be done. Could be long or short-lived. Parameters: timeout - a time duration (in milliseconds) within which theexecution of the Work instance must start. Otherwise, the Workinstance is rejected with a WorkRejectedException set to anappropriate error code (WorkRejectedException.TIMED_OUT). Parameters: ectx - an object containing the execution context with which thesubmitted Work instance must be executed. Parameters: listener - an object which would be notified when the various Workprocessing events (work accepted, work rejected, work started,work completed) occur. the time elapsed (in milliseconds) from Work acceptance untilstart of execution. Note, this does not offer real-timeguarantees. It is valid to return -1, if the actual start delayduration is unknown. throws: WorkRejectedException - a Work instance has been rejected fromfurther processing. throws: WorkException - |
stopThreads | public synchronized void stopThreads()(Code) | | Remove this WorkManager : Stop all threads
|
|
|