org.jboss.jca.core.workmanager

## Class WorkWrapper

- java.lang.Object
- - org.jboss.jca.core.workmanager.WorkWrapper

- All Implemented Interfaces:
    java.lang.Runnable

      public class WorkWrapper
      extends java.lang.Object
      implements java.lang.Runnable

  Wraps the resource adapter's work.
  Version:
    $Revision: 71538 $
  Author:
    Jesper Pedersen

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.jboss.jca.core.spi.security.SecurityIntegration` | `securityIntegration` The security integration
    `protected WorkManagerImpl` | `workManager` The work manager

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WorkWrapper(WorkManagerImpl workManager, org.jboss.jca.core.spi.security.SecurityIntegration si, javax.resource.spi.work.Work work, javax.resource.spi.work.ExecutionContext executionContext, javax.resource.spi.work.WorkListener workListener, java.util.concurrent.CountDownLatch startedLatch, java.util.concurrent.CountDownLatch completedLatch, long startTime)` Create a new WorkWrapper

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addWorkContext(java.lang.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(java.lang.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` | `runWork()` Runs the work.
    `protected void` | `start()` Start
    `java.lang.String` | `toString()` String representation

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### workManager

          protected WorkManagerImpl workManager

      The work manager

    - #### securityIntegration

          protected org.jboss.jca.core.spi.security.SecurityIntegration securityIntegration

      The security integration

  - ### Constructor Detail

    - #### WorkWrapper

          public WorkWrapper(WorkManagerImpl workManager,
                             org.jboss.jca.core.spi.security.SecurityIntegration si,
                             javax.resource.spi.work.Work work,
                             javax.resource.spi.work.ExecutionContext executionContext,
                             javax.resource.spi.work.WorkListener workListener,
                             java.util.concurrent.CountDownLatch startedLatch,
                             java.util.concurrent.CountDownLatch completedLatch,
                             long startTime)

      Create a new WorkWrapper
      Parameters:
        `workManager` - the work manager
        `si` - The security integration
        `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:
        `java.lang.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 `java.lang.Runnable`

    - #### start

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

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

    - #### runWork

          protected void runWork()
                          throws javax.resource.spi.work.WorkCompletedException

      Runs the work.
      Throws:
        `javax.resource.spi.work.WorkCompletedException` - if there is an error completing work execution

    - #### end

          protected void end()

      End

    - #### cancel

          protected void cancel()

      Cancel

    - #### getWorkContext

          public <T> T getWorkContext(java.lang.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(java.lang.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 java.lang.String toString()

      String representation
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        The string

Copyright © 2014 IronJacamar (http://www.ironjacamar.org)