| java.lang.Object org.ow2.easybeans.jca.workmanager.ResourceWorkManager
ResourceWorkManager | public class ResourceWorkManager implements WorkManager(Code) | | Implementation of the Resource Work Manager API.
author: Philippe Durieux (JOnAS) author: Florent Benoit (EasyBeans) |
Constructor Summary | |
public | ResourceWorkManager(TransactionManager transactionManager, int minsz, int maxsz, long threadwait) Default Constructor. |
Method Summary | |
public void | doWork(Work work) Accepts a Work instance for processing. | public void | doWork(Work work, long timeout, ExecutionContext executionContext, WorkListener workListener) Accepts a Work instance for processing. | public int | getCurrentPoolSize() | public int | getMaxPoolSize() | public int | getMinPoolSize() | public void | nextWork() Do 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 executionContext, WorkListener workListener) Accepts a Work instance for processing. | public void | setMaxPoolSize(int maxsz) Sets the max pool size. | public void | setMinPoolSize(int minsz) Sets the min pool size. | public long | startWork(Work work) Accepts a Work instance for processing. | public long | startWork(Work work, long timeout, ExecutionContext executionContext, WorkListener workListener) Accepts a Work instance for processing. | public synchronized void | stopThreads() Remove this WorkManager : Stop all threads. |
ResourceWorkManager | public ResourceWorkManager(TransactionManager transactionManager, int minsz, int maxsz, long threadwait)(Code) | | Default Constructor.
Parameters: minsz - the minimum pool size Parameters: maxsz - the maximum pool size Parameters: transactionManager - the transaction manager to use. Parameters: threadwait - max time in seconds a thread will wait. |
doWork | public void doWork(Work work) throws WorkRejectedException, WorkCompletedException, 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 fromfurther processing. throws: WorkCompletedException - a Work instance has completed executionwith an exception. throws: WorkException - if work is not done |
doWork | public void doWork(Work work, long timeout, ExecutionContext executionContext, WorkListener workListener) throws WorkRejectedException, WorkCompletedException, 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: executionContext - an object containing the execution context withwhich the submitted Work instance must be executed. Parameters: workListener - an object which would be notified when the variousWork processing events (work accepted, work rejected, workstarted, 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 - if work is not done |
getCurrentPoolSize | public int getCurrentPoolSize()(Code) | | current pool size |
getMaxPoolSize | public int getMaxPoolSize()(Code) | | max pool size |
getMinPoolSize | public int getMinPoolSize()(Code) | | min pool size |
scheduleWork | public void scheduleWork(Work work) throws WorkRejectedException, 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. throws: WorkRejectedException - - indicates that a Work instance has beenrejected from further processing. This can occur due to internalfactors. throws: WorkException - if work is not scheduled. |
scheduleWork | public void scheduleWork(Work work, long timeout, ExecutionContext executionContext, WorkListener workListener) throws WorkRejectedException, 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: executionContext - an object containing the execution context withwhich the submitted Work instance must be executed. Parameters: workListener - an object which would be notified when the variousWork processing events (work accepted, work rejected, workstarted, work completed) occur. throws: WorkRejectedException - a Work instance has been rejected fromfurther processing. throws: WorkException - if work is not scheduled. |
setMaxPoolSize | public void setMaxPoolSize(int maxsz)(Code) | | Sets the max pool size.
Parameters: maxsz - the max pool size. |
setMinPoolSize | public void setMinPoolSize(int minsz)(Code) | | Sets the min pool size.
Parameters: minsz - the min pool size. |
startWork | public long startWork(Work work) throws WorkRejectedException, 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 - if work is not started |
startWork | public long startWork(Work work, long timeout, ExecutionContext executionContext, WorkListener workListener) throws WorkRejectedException, 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: executionContext - an object containing the execution context withwhich the submitted Work instance must be executed. Parameters: workListener - an object which would be notified when the variousWork processing events (work accepted, work rejected, workstarted, 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 - if work is not started |
stopThreads | public synchronized void stopThreads()(Code) | | Remove this WorkManager : Stop all threads.
|
|
|