com.sun.enterprise.connectors.work
Class CommonWorkManager

java.lang.Object
  extended by com.sun.enterprise.connectors.work.CommonWorkManager
All Implemented Interfaces:
WorkManager

public final class CommonWorkManager
extends java.lang.Object
implements WorkManager

WorkManager implementation.

Author:
Binod P.G

Field Summary
 
Fields inherited from interface javax.resource.spi.work.WorkManager
IMMEDIATE, INDEFINITE, UNKNOWN
 
Constructor Summary
CommonWorkManager(java.lang.String threadPoolId, ConnectorRuntime runtime, java.lang.String raName, java.lang.ClassLoader cl)
          Private constructor.
 
Method Summary
 void cleanUp()
           
 void doWork(Work work)
          Executes the work instance.
 void doWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener)
          Executes the work instance.
 void scheduleWork(Work work)
          Executes the work instance.
 void scheduleWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener)
          Executes the work instance.
 long startWork(Work work)
          Executes the work instance.
 long startWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener)
          Executes the work instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonWorkManager

public CommonWorkManager(java.lang.String threadPoolId,
                         ConnectorRuntime runtime,
                         java.lang.String raName,
                         java.lang.ClassLoader cl)
                  throws ConnectorRuntimeException
Private constructor.

Parameters:
threadPoolId - Id of the thread pool.
Throws:
ConnectorRuntimeException - if thread pool is not accessible
Method Detail

cleanUp

public void cleanUp()

doWork

public void doWork(Work work)
            throws WorkException
Executes the work instance.

Specified by:
doWork in interface WorkManager
Parameters:
work - work instance from resource adapter
Throws:
WorkException - if there is an exception while executing work.

doWork

public void doWork(Work work,
                   long startTimeout,
                   ExecutionContext execContext,
                   WorkListener workListener)
            throws WorkException
Executes the work instance. The calling thread will wait until the end of work execution.

Specified by:
doWork in interface WorkManager
Parameters:
work - work instance from resource adapter
startTimeout - Timeout for the work.
execContext - Execution context in which the work will be executed.
workListener - Listener from RA that will listen to work events.
Throws:
WorkException - if there is an exception while executing work.

startWork

public long startWork(Work work)
               throws WorkException
Executes the work instance. The calling thread will wait until the start of work execution.

Specified by:
startWork in interface WorkManager
Parameters:
work - work instance from resource adapter
Throws:
WorkException - if there is an exception while executing work.

startWork

public long startWork(Work work,
                      long startTimeout,
                      ExecutionContext execContext,
                      WorkListener workListener)
               throws WorkException
Executes the work instance. The calling thread will wait until the start of work execution.

Specified by:
startWork in interface WorkManager
Parameters:
work - work instance from resource adapter
startTimeout - Timeout for the work.
execContext - Execution context in which the work will be executed.
workListener - Listener from RA that will listen to work events.
Throws:
WorkException - if there is an exception while executing work.

scheduleWork

public void scheduleWork(Work work)
                  throws WorkException
Executes the work instance. Calling thread will continue after scheduling the work

Specified by:
scheduleWork in interface WorkManager
Parameters:
work - work instance from resource adapter
Throws:
WorkException - if there is an exception while executing work.

scheduleWork

public void scheduleWork(Work work,
                         long startTimeout,
                         ExecutionContext execContext,
                         WorkListener workListener)
                  throws WorkException
Executes the work instance. Calling thread will continue after scheduling the work

Specified by:
scheduleWork in interface WorkManager
Parameters:
work - work instance from resource adapter
startTimeout - Timeout for the work.
execContext - Execution context in which the work will be executed.
workListener - Listener from RA that will listen to work events.
Throws:
WorkException - if there is an exception while executing work.


Copyright © 2012 GlassFish Community. All Rights Reserved.