org.objectweb.jonas.resource
Class ResourceWorkManager

java.lang.Object
  extended byorg.objectweb.jonas.resource.ResourceWorkManager
All Implemented Interfaces:
javax.resource.spi.work.WorkManager

public class ResourceWorkManager
extends java.lang.Object
implements javax.resource.spi.work.WorkManager

This class implements the WorkManager interface of the Connector Architecture 1.5 specification.


Field Summary
 
Fields inherited from interface javax.resource.spi.work.WorkManager
IMMEDIATE, INDEFINITE, UNKNOWN
 
Constructor Summary
ResourceWorkManager(org.objectweb.transaction.jta.TransactionManager tmgr, int minThreads, int maxThreads, int waitTimeout, int execTimeout, org.objectweb.util.monolog.api.Logger mlogger)
           
 
Method Summary
 void doWork(javax.resource.spi.work.Work work)
          Run the specified work object and wait until it completes to return
 void doWork(javax.resource.spi.work.Work work, long timeout, javax.resource.spi.work.ExecutionContext eCtx, javax.resource.spi.work.WorkListener wListen)
          Run the specified work object and wait until it completes to return
 void releasePool()
          Used for testing to cause the threads to go away
 void scheduleWork(javax.resource.spi.work.Work work)
          Run the specified work object and return when it has been accepted
 void scheduleWork(javax.resource.spi.work.Work work, long timeout, javax.resource.spi.work.ExecutionContext eCtx, javax.resource.spi.work.WorkListener wListen)
          Run the specified work object and return when it has been accepted
 void setInited()
          Called when the RA is deployed, this will allow the threads to execute the scheduled work objects
 long startWork(javax.resource.spi.work.Work work)
          Run the specified work object and return when it has been started
 long startWork(javax.resource.spi.work.Work work, long timeout, javax.resource.spi.work.ExecutionContext eCtx, javax.resource.spi.work.WorkListener wListen)
          Run the specified work object and return when it has started
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceWorkManager

public ResourceWorkManager(org.objectweb.transaction.jta.TransactionManager tmgr,
                           int minThreads,
                           int maxThreads,
                           int waitTimeout,
                           int execTimeout,
                           org.objectweb.util.monolog.api.Logger mlogger)
Method Detail

doWork

public void doWork(javax.resource.spi.work.Work work)
            throws javax.resource.spi.work.WorkException
Run the specified work object and wait until it completes to return

Specified by:
doWork in interface javax.resource.spi.work.WorkManager
Parameters:
work - the Work object to execute
Throws:
javax.resource.spi.work.WorkException - if an error occurs during the acceptance, starting or execution

doWork

public void doWork(javax.resource.spi.work.Work work,
                   long timeout,
                   javax.resource.spi.work.ExecutionContext eCtx,
                   javax.resource.spi.work.WorkListener wListen)
            throws javax.resource.spi.work.WorkException
Run the specified work object and wait until it completes to return

Specified by:
doWork in interface javax.resource.spi.work.WorkManager
Parameters:
work - the Work object to execute
timeout - the max number of milliseconds before Work object must start
eCtx - the ExecutionContext to use for the Work object
wListen - the WorkListener to use
Throws:
javax.resource.spi.work.WorkException - if an error occurs during the acceptance, starting or execution

startWork

public long startWork(javax.resource.spi.work.Work work)
               throws javax.resource.spi.work.WorkException
Run the specified work object and return when it has been started

Specified by:
startWork in interface javax.resource.spi.work.WorkManager
Parameters:
work - the Work object to execute
Returns:
long number of milliseconds elapsed between work acceptance and work start
Throws:
javax.resource.spi.work.WorkException - if an error occurs during the acceptance, starting or execution

startWork

public long startWork(javax.resource.spi.work.Work work,
                      long timeout,
                      javax.resource.spi.work.ExecutionContext eCtx,
                      javax.resource.spi.work.WorkListener wListen)
               throws javax.resource.spi.work.WorkException
Run the specified work object and return when it has started

Specified by:
startWork in interface javax.resource.spi.work.WorkManager
Parameters:
work - the Work object to execute
timeout - the max number of milliseconds before Work object must start
eCtx - the ExecutionContext to use for the Work object
wListen - the WorkListener to use
Returns:
long number of milliseconds elapsed between work acceptance and work start
Throws:
javax.resource.spi.work.WorkException - if an error occurs during the acceptance, starting or execution

scheduleWork

public void scheduleWork(javax.resource.spi.work.Work work)
                  throws javax.resource.spi.work.WorkException
Run the specified work object and return when it has been accepted

Specified by:
scheduleWork in interface javax.resource.spi.work.WorkManager
Parameters:
work - the Work object to execute
Throws:
javax.resource.spi.work.WorkException - if an error occurs during the acceptance, starting or execution

scheduleWork

public void scheduleWork(javax.resource.spi.work.Work work,
                         long timeout,
                         javax.resource.spi.work.ExecutionContext eCtx,
                         javax.resource.spi.work.WorkListener wListen)
                  throws javax.resource.spi.work.WorkException
Run the specified work object and return when it has been accepted

Specified by:
scheduleWork in interface javax.resource.spi.work.WorkManager
Parameters:
work - the Work object to execute
timeout - the max number of milliseconds before Work object must start
eCtx - the ExecutionContext to use for the Work object
wListen - the WorkListener to use
Throws:
javax.resource.spi.work.WorkException - if an error occurs during the acceptance, starting or execution

setInited

public void setInited()
Called when the RA is deployed, this will allow the threads to execute the scheduled work objects


releasePool

public void releasePool()
Used for testing to cause the threads to go away