|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ow2.easybeans.jca.workmanager.ResourceWorkManager
public class ResourceWorkManager
Implementation of the Resource Work Manager API.
Field Summary |
---|
Fields inherited from interface javax.resource.spi.work.WorkManager |
---|
IMMEDIATE, INDEFINITE, UNKNOWN |
Constructor Summary | |
---|---|
ResourceWorkManager(TransactionManager transactionManager,
int minsz,
int maxsz,
long threadwait)
Default Constructor. |
Method Summary | |
---|---|
void |
doWork(Work work)
Accepts a Work instance for processing. |
void |
doWork(Work work,
long timeout,
ExecutionContext executionContext,
WorkListener workListener)
Accepts a Work instance for processing. |
int |
getCurrentPoolSize()
|
int |
getMaxPoolSize()
|
int |
getMinPoolSize()
|
void |
nextWork()
Do the next JWork object to be run. |
void |
scheduleWork(Work work)
Accepts a Work instance for processing. |
void |
scheduleWork(Work work,
long timeout,
ExecutionContext executionContext,
WorkListener workListener)
Accepts a Work instance for processing. |
void |
setMaxPoolSize(int maxsz)
Sets the max pool size. |
void |
setMinPoolSize(int minsz)
Sets the min pool size. |
long |
startWork(Work work)
Accepts a Work instance for processing. |
long |
startWork(Work work,
long timeout,
ExecutionContext executionContext,
WorkListener workListener)
Accepts a Work instance for processing. |
void |
stopThreads()
Remove this WorkManager : Stop all threads. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceWorkManager(TransactionManager transactionManager, int minsz, int maxsz, long threadwait)
minsz
- the minimum pool sizemaxsz
- the maximum pool sizetransactionManager
- the transaction manager to use.threadwait
- max time in seconds a thread will wait.Method Detail |
---|
public int getCurrentPoolSize()
public int getMinPoolSize()
public int getMaxPoolSize()
public void setMinPoolSize(int minsz)
minsz
- the min pool size.public void setMaxPoolSize(int maxsz)
maxsz
- the max pool size.public void doWork(Work work) throws WorkRejectedException, WorkCompletedException, 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
- if work is not donepublic void doWork(Work work, long timeout, ExecutionContext executionContext, WorkListener workListener) throws WorkRejectedException, WorkCompletedException, 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).executionContext
- an object containing the execution context with
which the submitted Work instance must be executed.workListener
- 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
- if work is not donepublic long startWork(Work work) throws WorkRejectedException, 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
- if work is not startedpublic long startWork(Work work, long timeout, ExecutionContext executionContext, WorkListener workListener) throws WorkRejectedException, 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).executionContext
- an object containing the execution context with
which the submitted Work instance must be executed.workListener
- 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
- if work is not startedpublic void scheduleWork(Work work) throws WorkRejectedException, WorkException
scheduleWork
in interface WorkManager
work
- The unit of work to be done. Could be long or short-lived.
WorkRejectedException
- - indicates that a Work instance has been
rejected from further processing. This can occur due to internal
factors.
WorkException
- if work is not scheduled.public void scheduleWork(Work work, long timeout, ExecutionContext executionContext, WorkListener workListener) throws WorkRejectedException, 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).executionContext
- an object containing the execution context with
which the submitted Work instance must be executed.workListener
- 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
- if work is not scheduled.public void nextWork() throws WorkException, java.lang.InterruptedException, ResourceWorkManagerStoppedException
WorkException
- if work is not done
java.lang.InterruptedException
- if one object can't wait.
ResourceWorkManagerStoppedException
- if the manager is stopped.public void stopThreads()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |