org.jboss.jca.core.workmanager

## Class WorkManagerImpl

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

- All Implemented Interfaces:
    java.lang.Cloneable, javax.resource.spi.work.WorkManager, org.jboss.jca.core.spi.graceful.GracefulShutdown
  Direct Known Subclasses:
    DistributedWorkManagerImpl

      public class WorkManagerImpl
      extends java.lang.Object
      implements org.jboss.jca.core.api.workmanager.WorkManager

  The work manager implementation.
  Author:
    Jesper Pedersen

- - ### Field Summary

    - ### Fields inherited from interface javax.resource.spi.work.WorkManager

      `IMMEDIATE, INDEFINITE, UNKNOWN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WorkManagerImpl()` Constructor - by default the WorkManager is running in spec-compliant mode

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `cancelShutdown()` Cancel shutdown
    `org.jboss.jca.core.api.workmanager.WorkManager` | `clone()` Clone the WorkManager implementation
    `protected WorkWrapper` | `createWorkWrapper(org.jboss.jca.core.spi.security.SecurityIntegration securityIntegration, 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)` Crestes a wrapper for work
    `protected void` | `deltaDoWorkAccepted()` Delta doWork accepted
    `protected void` | `deltaDoWorkRejected()` Delta doWork rejected
    `protected void` | `deltaScheduleWorkAccepted()` Delta scheduleWork accepted
    `protected void` | `deltaScheduleWorkRejected()` Delta scheduleWork rejected
    `protected void` | `deltaStartWorkAccepted()` Delta startWork accepted
    `protected void` | `deltaStartWorkRejected()` Delta startWork rejected
    `protected void` | `deltaWorkFailed()` Delta work failed
    `protected void` | `deltaWorkSuccessful()` Delta work successful
    `void` | `doFirstChecks(javax.resource.spi.work.Work work, long startTimeout, javax.resource.spi.work.ExecutionContext execContext)` Do first checks for work starting methods
    `void` | `doWork(javax.resource.spi.work.Work work)`
    `void` | `doWork(javax.resource.spi.work.Work work, long startTimeout, javax.resource.spi.work.ExecutionContext execContext, javax.resource.spi.work.WorkListener workListener)`
    `org.jboss.jca.core.spi.security.Callback` | `getCallbackSecurity()` Get the callback security module
    `int` | `getDelay()` Get the delay until shutdown occurs
    `java.lang.String` | `getId()` Get the unique id of the work manager
    `org.jboss.jca.core.api.workmanager.StatisticsExecutor` | `getLongRunningThreadPool()` Retrieve the executor for long running tasks
    `java.lang.String` | `getName()` Get the name of the work manager
    `javax.resource.spi.ResourceAdapter` | `getResourceAdapter()` Get the resource adapter
    `org.jboss.jca.core.spi.security.SecurityIntegration` | `getSecurityIntegration()` Get the security integration module
    `org.jboss.jca.core.api.workmanager.StatisticsExecutor` | `getShortRunningThreadPool()` Retrieve the executor for short running tasks
    `org.jboss.jca.core.api.workmanager.WorkManagerStatistics` | `getStatistics()` Get the statistics
    `org.jboss.jca.core.spi.transaction.xa.XATerminator` | `getXATerminator()` Get the XATerminator
    `boolean` | `isShutdown()` Is the component shutdown
    `boolean` | `isSpecCompliant()` Is spec compliant
    `boolean` | `isStatisticsEnabled()` Is statistics enabled
    `void` | `prepareShutdown()` Signal the component to prepare for shutdown
    `void` | `prepareShutdown(org.jboss.jca.core.spi.graceful.GracefulCallback cb)` Signal the component to prepare for shutdown
    `void` | `prepareShutdown(int seconds)` Signal the component to prepare for shutdown
    `void` | `prepareShutdown(int seconds, org.jboss.jca.core.spi.graceful.GracefulCallback cb)` Signal the component to prepare for shutdown
    `void` | `scheduleWork(javax.resource.spi.work.Work work)`
    `void` | `scheduleWork(javax.resource.spi.work.Work work, long startTimeout, javax.resource.spi.work.ExecutionContext execContext, javax.resource.spi.work.WorkListener workListener)`
    `void` | `setCallbackSecurity(org.jboss.jca.core.spi.security.Callback v)` Set callback security module
    `void` | `setId(java.lang.String v)` Set the unique id of the work manager
    `void` | `setLongRunningThreadPool(org.jboss.threads.BlockingExecutor executor)` Set the executor for long running tasks
    `void` | `setName(java.lang.String v)` Set the name of the work manager
    `void` | `setResourceAdapter(javax.resource.spi.ResourceAdapter v)` Set the resource adapter
    `void` | `setSecurityIntegration(org.jboss.jca.core.spi.security.SecurityIntegration v)` Set security intergation module
    `void` | `setShortRunningThreadPool(org.jboss.threads.BlockingExecutor executor)` Set the executor for short running tasks
    `void` | `setSpecCompliant(boolean v)` Set spec compliant flag
    `void` | `setStatisticsEnabled(boolean v)` Set the statistics enabled flag
    `void` | `setXATerminator(org.jboss.jca.core.spi.transaction.xa.XATerminator xaTerminator)` Set the XATerminator
    `void` | `shutdown()` Shutdown the component
    `long` | `startWork(javax.resource.spi.work.Work work)`
    `long` | `startWork(javax.resource.spi.work.Work work, long startTimeout, javax.resource.spi.work.ExecutionContext execContext, javax.resource.spi.work.WorkListener workListener)`
    `java.lang.String` | `toString()` String representation
    `void` | `toString(java.lang.StringBuilder sb)` Additional string representation

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

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

- - ### Constructor Detail

    - #### WorkManagerImpl

          public WorkManagerImpl()

      Constructor - by default the WorkManager is running in spec-compliant mode

  - ### Method Detail

    - #### getId

          public java.lang.String getId()

      Get the unique id of the work manager
      Returns:
        The value

    - #### setId

          public void setId(java.lang.String v)

      Set the unique id of the work manager
      Parameters:
        `v` - The value

    - #### getName

          public java.lang.String getName()

      Get the name of the work manager
      Returns:
        The value

    - #### setName

          public void setName(java.lang.String v)

      Set the name of the work manager
      Parameters:
        `v` - The value

    - #### getShortRunningThreadPool

          public org.jboss.jca.core.api.workmanager.StatisticsExecutor getShortRunningThreadPool()

      Retrieve the executor for short running tasks
      Returns:
        The executor

    - #### setShortRunningThreadPool

          public void setShortRunningThreadPool(org.jboss.threads.BlockingExecutor executor)

      Set the executor for short running tasks
      Parameters:
        `executor` - The executor

    - #### getLongRunningThreadPool

          public org.jboss.jca.core.api.workmanager.StatisticsExecutor getLongRunningThreadPool()

      Retrieve the executor for long running tasks
      Returns:
        The executor

    - #### setLongRunningThreadPool

          public void setLongRunningThreadPool(org.jboss.threads.BlockingExecutor executor)

      Set the executor for long running tasks
      Parameters:
        `executor` - The executor

    - #### getXATerminator

          public org.jboss.jca.core.spi.transaction.xa.XATerminator getXATerminator()

      Get the XATerminator
      Returns:
        The XA terminator

    - #### setXATerminator

          public void setXATerminator(org.jboss.jca.core.spi.transaction.xa.XATerminator xaTerminator)

      Set the XATerminator
      Parameters:
        `xaTerminator` - The XA terminator

    - #### isSpecCompliant

          public boolean isSpecCompliant()

      Is spec compliant
      Returns:
        True if spec compliant; otherwise false

    - #### setSpecCompliant

          public void setSpecCompliant(boolean v)

      Set spec compliant flag
      Parameters:
        `v` - The value

    - #### getCallbackSecurity

          public org.jboss.jca.core.spi.security.Callback getCallbackSecurity()

      Get the callback security module
      Returns:
        The value

    - #### setCallbackSecurity

          public void setCallbackSecurity(org.jboss.jca.core.spi.security.Callback v)

      Set callback security module
      Parameters:
        `v` - The value

    - #### getSecurityIntegration

          public org.jboss.jca.core.spi.security.SecurityIntegration getSecurityIntegration()

      Get the security integration module
      Returns:
        The value

    - #### setSecurityIntegration

          public void setSecurityIntegration(org.jboss.jca.core.spi.security.SecurityIntegration v)

      Set security intergation module
      Parameters:
        `v` - The value

    - #### getResourceAdapter

          public javax.resource.spi.ResourceAdapter getResourceAdapter()

      Get the resource adapter
      Returns:
        The value

    - #### setResourceAdapter

          public void setResourceAdapter(javax.resource.spi.ResourceAdapter v)

      Set the resource adapter
      Parameters:
        `v` - The value

    - #### isStatisticsEnabled

          public boolean isStatisticsEnabled()

      Is statistics enabled
      Returns:
        True if enabled; otherwise false

    - #### setStatisticsEnabled

          public void setStatisticsEnabled(boolean v)

      Set the statistics enabled flag
      Parameters:
        `v` - The value

    - #### getStatistics

          public org.jboss.jca.core.api.workmanager.WorkManagerStatistics getStatistics()

      Get the statistics
      Returns:
        The value

    - #### clone

          public org.jboss.jca.core.api.workmanager.WorkManager clone()
                                                               throws java.lang.CloneNotSupportedException

      Clone the WorkManager implementation
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        A copy of the implementation
      Throws:
        `java.lang.CloneNotSupportedException` - Thrown if the copy operation isn't supported

    - #### doWork

          public void doWork(javax.resource.spi.work.Work work)
                      throws javax.resource.spi.work.WorkException

      Specified by:
        `doWork` in interface `javax.resource.spi.work.WorkManager`
      Throws:
        `javax.resource.spi.work.WorkException`

    - #### doWork

          public void doWork(javax.resource.spi.work.Work work,
                             long startTimeout,
                             javax.resource.spi.work.ExecutionContext execContext,
                             javax.resource.spi.work.WorkListener workListener)
                      throws javax.resource.spi.work.WorkException

      Specified by:
        `doWork` in interface `javax.resource.spi.work.WorkManager`
      Throws:
        `javax.resource.spi.work.WorkException`

    - #### startWork

          public long startWork(javax.resource.spi.work.Work work)
                         throws javax.resource.spi.work.WorkException

      Specified by:
        `startWork` in interface `javax.resource.spi.work.WorkManager`
      Throws:
        `javax.resource.spi.work.WorkException`

    - #### startWork

          public long startWork(javax.resource.spi.work.Work work,
                                long startTimeout,
                                javax.resource.spi.work.ExecutionContext execContext,
                                javax.resource.spi.work.WorkListener workListener)
                         throws javax.resource.spi.work.WorkException

      Specified by:
        `startWork` in interface `javax.resource.spi.work.WorkManager`
      Throws:
        `javax.resource.spi.work.WorkException`

    - #### scheduleWork

          public void scheduleWork(javax.resource.spi.work.Work work)
                            throws javax.resource.spi.work.WorkException

      Specified by:
        `scheduleWork` in interface `javax.resource.spi.work.WorkManager`
      Throws:
        `javax.resource.spi.work.WorkException`

    - #### scheduleWork

          public void scheduleWork(javax.resource.spi.work.Work work,
                                   long startTimeout,
                                   javax.resource.spi.work.ExecutionContext execContext,
                                   javax.resource.spi.work.WorkListener workListener)
                            throws javax.resource.spi.work.WorkException

      Specified by:
        `scheduleWork` in interface `javax.resource.spi.work.WorkManager`
      Throws:
        `javax.resource.spi.work.WorkException`

    - #### createWorkWrapper

          protected WorkWrapper createWorkWrapper(org.jboss.jca.core.spi.security.SecurityIntegration securityIntegration,
                                                  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)

      Crestes a wrapper for work
      Parameters:
        `securityIntegration` - the security integration
        `work` - the work
        `executionContext` - the execution context
        `workListener` - the work listener
        `startedLatch` - latch that will be notified when work starts execution. Can be null.
        `completedLatch` - latch that will be notified when work completes execution. Can be null.
      Returns:
        the created work wrapper

    - #### deltaDoWorkAccepted

          protected void deltaDoWorkAccepted()

      Delta doWork accepted

    - #### deltaDoWorkRejected

          protected void deltaDoWorkRejected()

      Delta doWork rejected

    - #### deltaStartWorkAccepted

          protected void deltaStartWorkAccepted()

      Delta startWork accepted

    - #### deltaStartWorkRejected

          protected void deltaStartWorkRejected()

      Delta startWork rejected

    - #### deltaScheduleWorkAccepted

          protected void deltaScheduleWorkAccepted()

      Delta scheduleWork accepted

    - #### deltaScheduleWorkRejected

          protected void deltaScheduleWorkRejected()

      Delta scheduleWork rejected

    - #### deltaWorkSuccessful

          protected void deltaWorkSuccessful()

      Delta work successful

    - #### deltaWorkFailed

          protected void deltaWorkFailed()

      Delta work failed

    - #### doFirstChecks

          public void doFirstChecks(javax.resource.spi.work.Work work,
                                    long startTimeout,
                                    javax.resource.spi.work.ExecutionContext execContext)
                             throws javax.resource.spi.work.WorkException

      Do first checks for work starting methods
      Parameters:
        `work` - to check
        `startTimeout` - to check
        `execContext` - to check
      Throws:
        `javax.resource.spi.work.WorkException` - in case of check don't pass

    - #### cancelShutdown

          public boolean cancelShutdown()

      Cancel shutdown
      Specified by:
        `cancelShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Returns:
        True if the shutdown was canceled; false otherwise

    - #### prepareShutdown

          public void prepareShutdown()

      Signal the component to prepare for shutdown
      Specified by:
        `prepareShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`

    - #### prepareShutdown

          public void prepareShutdown(org.jboss.jca.core.spi.graceful.GracefulCallback cb)

      Signal the component to prepare for shutdown
      Specified by:
        `prepareShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Parameters:
        `cb` - The callback handle

    - #### prepareShutdown

          public void prepareShutdown(int seconds)

      Signal the component to prepare for shutdown
      Specified by:
        `prepareShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Parameters:
        `seconds` - The number of seconds after which shutdown is forced

    - #### prepareShutdown

          public void prepareShutdown(int seconds,
                                      org.jboss.jca.core.spi.graceful.GracefulCallback cb)

      Signal the component to prepare for shutdown
      Specified by:
        `prepareShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Parameters:
        `seconds` - The number of seconds after which shutdown is forced
        `cb` - The callback handle

    - #### shutdown

          public void shutdown()

      Shutdown the component
      Specified by:
        `shutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`

    - #### isShutdown

          public boolean isShutdown()

      Is the component shutdown
      Specified by:
        `isShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Returns:
        True if shutdown; false if active

    - #### getDelay

          public int getDelay()

      Get the delay until shutdown occurs
      Specified by:
        `getDelay` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Returns:
        The number of seconds, `Integer.MAX_VALUE` for active, or `Integer.MIN_VALUE` for inactive

    - #### toString

          public java.lang.String toString()

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

    - #### toString

          public void toString(java.lang.StringBuilder sb)

      Additional string representation
      Parameters:
        `sb` - The string builder

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