org.jboss.jca.core.workmanager
Class WorkWrapper

java.lang.Object
  extended by org.jboss.jca.core.workmanager.WorkWrapper
All Implemented Interfaces:
Runnable

public class WorkWrapper
extends Object
implements Runnable

Wraps the resource adapter's work.

Version:
$Revision: 71538 $
Author:
Jesper Pedersen

Constructor Summary
WorkWrapper(WorkManagerImpl workManager, javax.resource.spi.work.Work work, javax.resource.spi.work.ExecutionContext executionContext, javax.resource.spi.work.WorkListener workListener, CountDownLatch startedLatch, CountDownLatch completedLatch, long startTime)
          Create a new WorkWrapper
 
Method Summary
 void addWorkContext(Class<? extends javax.resource.spi.work.WorkContext> workContextClass, javax.resource.spi.work.WorkContext workContext)
          Adds new work context.
protected  void cancel()
          Cancel
protected  void end()
          End
 javax.resource.spi.work.ExecutionContext getExecutionContext()
          Retrieve the exection context
 javax.resource.spi.work.Work getWork()
          Retrieve the work
<T> T
getWorkContext(Class<T> workContextClass)
          Returns work context instance.
 javax.resource.spi.work.WorkException getWorkException()
          Get any exception
 javax.resource.spi.work.WorkListener getWorkListener()
          Retrieve the work listener
 org.jboss.jca.core.api.workmanager.WorkManager getWorkManager()
          Get the work manager
 void run()
          Run
protected  void start()
          Start
 String toString()
          String representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WorkWrapper

public WorkWrapper(WorkManagerImpl workManager,
                   javax.resource.spi.work.Work work,
                   javax.resource.spi.work.ExecutionContext executionContext,
                   javax.resource.spi.work.WorkListener workListener,
                   CountDownLatch startedLatch,
                   CountDownLatch completedLatch,
                   long startTime)
Create a new WorkWrapper

Parameters:
workManager - the work manager
work - the work
executionContext - the execution context
workListener - the WorkListener
startedLatch - The latch for when work has started
completedLatch - The latch for when work has completed
startTime - The start time
Throws:
IllegalArgumentException - for null work, execution context or a negative start timeout
Method Detail

getWorkManager

public org.jboss.jca.core.api.workmanager.WorkManager getWorkManager()
Get the work manager

Returns:
the work manager

getWork

public javax.resource.spi.work.Work getWork()
Retrieve the work

Returns:
the work

getExecutionContext

public javax.resource.spi.work.ExecutionContext getExecutionContext()
Retrieve the exection context

Returns:
the execution context

getWorkListener

public javax.resource.spi.work.WorkListener getWorkListener()
Retrieve the work listener

Returns:
the WorkListener

getWorkException

public javax.resource.spi.work.WorkException getWorkException()
Get any exception

Returns:
the exception or null if there is none

run

public void run()
Run

Specified by:
run in interface Runnable

start

protected void start()
              throws javax.resource.spi.work.WorkException
Start

Throws:
javax.resource.spi.work.WorkException - for any error

end

protected void end()
End


cancel

protected void cancel()
Cancel


getWorkContext

public <T> T getWorkContext(Class<T> workContextClass)
Returns work context instance.

Type Parameters:
T - class type info
Parameters:
workContextClass - work context type
Returns:
work context instance

addWorkContext

public void addWorkContext(Class<? extends javax.resource.spi.work.WorkContext> workContextClass,
                           javax.resource.spi.work.WorkContext workContext)
Adds new work context.

Parameters:
workContext - new work context
workContextClass - work context class

toString

public String toString()
String representation

Overrides:
toString in class Object
Returns:
The string


Copyright © 2012 JBoss, by Red Hat (http://www.jboss.org/ironjacamar)