org.jboss.resource.work
Class JBossWorkManager

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.resource.work.JBossWorkManager
All Implemented Interfaces:
MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src) , WorkManager (src)

public class JBossWorkManager
extends ServiceMBeanSupport (src)
implements WorkManager (src)

The work manager implementation


Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface javax.resource.spi.work.WorkManager (src)
IMMEDIATE, INDEFINITE, UNKNOWN
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
JBossWorkManager()
           
 
Method Summary
protected  void cancelWork(WorkWrapper (src)  wrapper)
          Cancel work
 void doWork(Work (src)  work)
          Executes the work, the call blocks until the work completes
 void doWork(Work (src)  work, long startTimeout, ExecutionContext (src)  ctx, WorkListener (src)  listener)
          Executes the work, the call blocks until the work completes
protected  void endWork(WorkWrapper (src)  wrapper)
          End work
protected  void executeWork(WorkWrapper (src)  wrapper)
          Execute the work
 WorkManager (src) getInstance()
          Get the reference to this work manager
 ThreadPool (src) getThreadPool()
          Retrieve the thread pool
 ObjectName (src) getThreadPoolName()
          Get the thread pool name
 ObjectName (src) getXATerminatorName()
          Get the XATerminator
protected  void importWork(WorkWrapper (src)  wrapper)
          Import any work
 void scheduleWork(Work (src)  work)
          Executes the work, the call returns immediatley
 void scheduleWork(Work (src)  work, long startTimeout, ExecutionContext (src)  ctx, WorkListener (src)  listener)
          Executes the work, the call returns immediately
 void setThreadPool(ThreadPool (src)  threadPool)
          Set the thread pool
 void setThreadPoolName(ObjectName (src)  threadPoolName)
          Set the thread pool name
 void setXATerminatorName(ObjectName (src)  xaTerminatorName)
          Set the xa terminator
protected  void startService()
          Sub-classes should override this method to provide custum 'start' logic.
 long startWork(Work (src)  work)
          Executes the work, the call blocks until the work starts
 long startWork(Work (src)  work, long startTimeout, ExecutionContext (src)  ctx, WorkListener (src)  listener)
          Executes the work, the call blocks until the work starts
protected  void startWork(WorkWrapper (src)  wrapper)
          Start work
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop, stopService
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JBossWorkManager

public JBossWorkManager()
Method Detail

getThreadPool

public ThreadPool (src)  getThreadPool()
Retrieve the thread pool

Returns:
the thread pool

setThreadPool

public void setThreadPool(ThreadPool (src)  threadPool)
Set the thread pool

Parameters:
threadPool - the thread pool

getThreadPoolName

public ObjectName (src)  getThreadPoolName()
Get the thread pool name

Returns:
the thread pool name

setThreadPoolName

public void setThreadPoolName(ObjectName (src)  threadPoolName)
Set the thread pool name

Parameters:
threadPoolName - the thread pool name

getXATerminatorName

public ObjectName (src)  getXATerminatorName()
Get the XATerminator

Returns:
the xa terminator

setXATerminatorName

public void setXATerminatorName(ObjectName (src)  xaTerminatorName)
Set the xa terminator


getInstance

public WorkManager (src)  getInstance()
Get the reference to this work manager

Returns:
the work manager

doWork

public void doWork(Work (src)  work,
                   long startTimeout,
                   ExecutionContext (src)  ctx,
                   WorkListener (src)  listener)
            throws WorkException (src) 
Description copied from interface: WorkManager (src)
Executes the work, the call blocks until the work completes

Specified by:
doWork in interface WorkManager (src)
Parameters:
work - the work
startTimeout - the wait before execution
ctx - the execution context
listener - the work listener
Throws:
WorkException (src) - a generic error

doWork

public void doWork(Work (src)  work)
            throws WorkException (src) 
Description copied from interface: WorkManager (src)
Executes the work, the call blocks until the work completes

Specified by:
doWork in interface WorkManager (src)
Parameters:
work - the work
Throws:
WorkException (src) - a generic error

startWork

public long startWork(Work (src)  work,
                      long startTimeout,
                      ExecutionContext (src)  ctx,
                      WorkListener (src)  listener)
               throws WorkException (src) 
Description copied from interface: WorkManager (src)
Executes the work, the call blocks until the work starts

Specified by:
startWork in interface WorkManager (src)
Parameters:
work - the work
startTimeout - the wait before execution
ctx - the execution context
listener - the work listener
Returns:
the time elapsed until the work starts
Throws:
WorkException (src) - a generic error

startWork

public long startWork(Work (src)  work)
               throws WorkException (src) 
Description copied from interface: WorkManager (src)
Executes the work, the call blocks until the work starts

Specified by:
startWork in interface WorkManager (src)
Parameters:
work - the work
Returns:
the time elapsed until the work starts
Throws:
WorkException (src) - a generic error

scheduleWork

public void scheduleWork(Work (src)  work,
                         long startTimeout,
                         ExecutionContext (src)  ctx,
                         WorkListener (src)  listener)
                  throws WorkException (src) 
Description copied from interface: WorkManager (src)
Executes the work, the call returns immediately

Specified by:
scheduleWork in interface WorkManager (src)
Parameters:
work - the work
startTimeout - the wait before execution
ctx - the execution context
listener - the work listener
Throws:
WorkException (src) - a generic error

scheduleWork

public void scheduleWork(Work (src)  work)
                  throws WorkException (src) 
Description copied from interface: WorkManager (src)
Executes the work, the call returns immediatley

Specified by:
scheduleWork in interface WorkManager (src)
Parameters:
work - the work
Throws:
WorkException (src) - a generic error

startService

protected void startService()
                     throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'start' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
startService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

importWork

protected void importWork(WorkWrapper (src)  wrapper)
                   throws WorkException (src) 
Import any work

Parameters:
wrapper - the work wrapper
Throws:
WorkException (src) - for any error

executeWork

protected void executeWork(WorkWrapper (src)  wrapper)
                    throws WorkException (src) 
Execute the work

Parameters:
wrapper - the work wrapper
Throws:
WorkException (src) - for any error

startWork

protected void startWork(WorkWrapper (src)  wrapper)
                  throws WorkException (src) 
Start work

Parameters:
wrapper - the work wrapper
Throws:
WorkException (src) - for any error

endWork

protected void endWork(WorkWrapper (src)  wrapper)
End work

Parameters:
wrapper - the work wrapper
Throws:
WorkException (src) - for any error

cancelWork

protected void cancelWork(WorkWrapper (src)  wrapper)
Cancel work

Parameters:
wrapper - the work wrapper
Throws:
WorkException (src) - for any error