WorkerContext (Mule ESB 2.2.1 API)
Keywords: org.mule.work.WorkerContext class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.work
Class WorkerContext

    java.lang.Object
      org.mule.work.WorkerContext

All Implemented Interfaces:
  Runnable, javax.resource.spi.work.Work

    public class WorkerContext

extends Object
implements javax.resource.spi.work.Work

`WorkerContext` TODO

Field Summary
`protected static Log` | `logger` logger used by this class

Constructor Summary
`WorkerContext(javax.resource.spi.work.Work work)` Create a WorkWrapper.
`WorkerContext(javax.resource.spi.work.Work aWork, long aStartTimeout, javax.resource.spi.work.ExecutionContext execContext, javax.resource.spi.work.WorkListener workListener)` Create a WorkWrapper with the specified execution context.

Method Summary
`long` | `getAcceptedTime()` System.currentTimeMillis() when the Work has been accepted.
`long` | `getStartTimeout()` Gets the time duration (in milliseconds) within which the execution of the Work instance must start.
`int` | `getThreadPriority()` Gets the priority level of the thread, which will be dispatched to process this work.
`javax.resource.spi.work.WorkException` | `getWorkException()` Gets the WorkException, if any, thrown during the execution.
`boolean` | `isTimedOut()` Used by a Work executor in order to know if this work, which should be accepted but not started has timed out.
`Latch` | `provideEndLatch()` Provides a latch, which can be used to wait the end of a work execution.
`Latch` | `provideStartLatch()` Provides a latch, which can be used to wait the start of a work execution.
`void` | `release()`
`void` | `run()`
`void` | `setThreadPriority(int aPriority)` Defines the thread priority level of the thread, which will be dispatched to process this work.
`String` | `toString()`
`void` | `workAccepted(Object anObject)` Call-back method used by a Work executor in order to notify this instance that the wrapped Work instance has been accepted.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### logger

    protected static final Log logger

  logger used by this class

Constructor Detail

### WorkerContext

    public WorkerContext(javax.resource.spi.work.Work work)

  Create a WorkWrapper.

  Parameters:
    `work` - Work to be wrapped.

### WorkerContext

    public WorkerContext(javax.resource.spi.work.Work aWork,
                         long aStartTimeout,
                         javax.resource.spi.work.ExecutionContext execContext,
                         javax.resource.spi.work.WorkListener workListener)

  Create a WorkWrapper with the specified execution context.

  Parameters:
    `aWork` - Work to be wrapped.
    `aStartTimeout` - a time duration (in milliseconds) within which the execution of the Work instance must start.
    `execContext` - an object containing the execution context with which the submitted Work instance must be executed.
    `workListener` - an object which would be notified when the various Work processing events (work accepted, work rejected, work started,

Method Detail

### release

    public void release()

  Specified by:
    `release` in interface `javax.resource.spi.work.Work`

### setThreadPriority

    public void setThreadPriority(int aPriority)

  Defines the thread priority level of the thread, which will be dispatched to process this work. This priority level must be the same one for a given resource adapter.

  Parameters:
    `aPriority` - Priority of the thread to be used to process the wrapped Work instance.

### getThreadPriority

    public int getThreadPriority()

  Gets the priority level of the thread, which will be dispatched to process this work. This priority level must be the same one for a given resource adapter.

  Returns:
    The priority level of the thread to be dispatched to process the wrapped Work instance.

### workAccepted

    public void workAccepted(Object anObject)

  Call-back method used by a Work executor in order to notify this instance that the wrapped Work instance has been accepted.

  Parameters:
    `anObject` - Object on which the event initially occurred. It should be the work executor.

### getAcceptedTime

    public long getAcceptedTime()

  System.currentTimeMillis() when the Work has been accepted. This method can be used to compute the duration of a work.

  Returns:
    When the work has been accepted.

### getStartTimeout

    public long getStartTimeout()

  Gets the time duration (in milliseconds) within which the execution of the Work instance must start.

  Returns:
    Time out duration.

### isTimedOut

    public boolean isTimedOut()

  Used by a Work executor in order to know if this work, which should be accepted but not started has timed out. This method MUST be called prior to retry the execution of a Work.

  Returns:
    true if the Work has timed out and false otherwise.

### getWorkException

    public javax.resource.spi.work.WorkException getWorkException()

  Gets the WorkException, if any, thrown during the execution.

  Returns:
    WorkException, if any.

### run

    public void run()

  Specified by:
    `run` in interface `Runnable`

### provideStartLatch

    public Latch provideStartLatch()

  Provides a latch, which can be used to wait the start of a work execution.

  Returns:
    Latch that a caller can acquire to wait for the start of a work execution.

### provideEndLatch

    public Latch provideEndLatch()

  Provides a latch, which can be used to wait the end of a work execution.

  Returns:
    Latch that a caller can acquire to wait for the end of a work execution.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.