org.jboss.resource.work
Class WorkWrapper

java.lang.Object
  extended byorg.jboss.util.threadpool.BasicTaskWrapper (src) 
      extended byorg.jboss.resource.work.WorkWrapper
All Implemented Interfaces:
java.lang.Runnable, Task (src) , TaskWrapper (src)

public class WorkWrapper
extends BasicTaskWrapper (src)
implements Task (src)

Wraps the resource adapter's work.


Field Summary
 
Fields inherited from class org.jboss.util.threadpool.BasicTaskWrapper (src)
TASK_ACCEPTED, TASK_COMPLETED, TASK_NOT_ACCEPTED, TASK_REJECTED, TASK_STARTED, TASK_STOPPED
 
Fields inherited from interface org.jboss.util.threadpool.Task (src)
WAIT_FOR_COMPLETE, WAIT_FOR_START, WAIT_NONE
 
Constructor Summary
WorkWrapper(JBossWorkManager (src)  workManager, Work (src)  work, int waitType, long startTimeout, ExecutionContext (src)  executionContext, WorkListener (src)  workListener)
          Create a new WorkWrapper
 
Method Summary
 void accepted(long time)
          The task has been accepted
 void completed(long time, java.lang.Throwable throwable)
          The task has been completed
 void execute()
          Execute the task
 long getBlockedElapsed()
          Retrieve the time blocked
 long getCompletionTimeout()
          The time before the task must be completed
 ExecutionContext (src) getExecutionContext()
          Retrieve the exection context
 int getPriority()
          The priority of the task
 long getStartTimeout()
          The time before the task must be accepted
 int getWaitType()
          Get the type of wait
 Work (src) getWork()
          Retrieve the work
 WorkException (src) getWorkException()
          Get any exception
 WorkListener (src) getWorkListener()
          Retrieve the work listener
 JBossWorkManager (src) getWorkManager()
          Get the work manager
 void rejected(long time, java.lang.Throwable throwable)
          The task has been rejected
 void started(long time)
          The task has been started
 void stop()
          Invoked by the threadpool when it wants to stop the task
 java.lang.String toString()
           
 
Methods inherited from class org.jboss.util.threadpool.BasicTaskWrapper (src)
acceptTask, getElapsedTime, getTaskCompletionTimeout, getTaskPriority, getTaskStartTimeout, getTaskWaitType, isComplete, rejectTask, run, setTask, stopTask, taskAccepted, taskCompleted, taskRejected, taskStarted, taskStop, waitForTask
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WorkWrapper

public WorkWrapper(JBossWorkManager (src)  workManager,
                   Work (src)  work,
                   int waitType,
                   long startTimeout,
                   ExecutionContext (src)  executionContext,
                   WorkListener (src)  workListener)
Create a new WorkWrapper

Parameters:
workManager - the work manager
work - the work
waitType - the waitType
executionContext - the execution context
Throws:
java.lang.IllegalArgumentException - for null work, execution context or a negative start timeout
Method Detail

getWorkManager

public JBossWorkManager (src)  getWorkManager()
Get the work manager

Returns:
the work manager

getWork

public Work (src)  getWork()
Retrieve the work

Returns:
the work

getWorkListener

public WorkListener (src)  getWorkListener()
Retrieve the work listener

Returns:
the WorkListener

getExecutionContext

public ExecutionContext (src)  getExecutionContext()
Retrieve the exection context

Returns:
the execution context

getBlockedElapsed

public long getBlockedElapsed()
Retrieve the time blocked

Returns:
the blocked time

getWorkException

public WorkException (src)  getWorkException()
Get any exception

Returns:
the exception or null if there is none

getWaitType

public int getWaitType()
Description copied from interface: Task (src)
Get the type of wait

Specified by:
getWaitType in interface Task (src)
Returns:
the wait type

getPriority

public int getPriority()
Description copied from interface: Task (src)
The priority of the task

Specified by:
getPriority in interface Task (src)
Returns:
the task priority

getStartTimeout

public long getStartTimeout()
Description copied from interface: Task (src)
The time before the task must be accepted

Specified by:
getStartTimeout in interface Task (src)
Returns:
the start timeout

getCompletionTimeout

public long getCompletionTimeout()
Description copied from interface: Task (src)
The time before the task must be completed

Specified by:
getCompletionTimeout in interface Task (src)
Returns:
the completion timeout

execute

public void execute()
Description copied from interface: Task (src)
Execute the task

Specified by:
execute in interface Task (src)

stop

public void stop()
Description copied from interface: Task (src)
Invoked by the threadpool when it wants to stop the task

Specified by:
stop in interface Task (src)

accepted

public void accepted(long time)
Description copied from interface: Task (src)
The task has been accepted

Specified by:
accepted in interface Task (src)
Parameters:
time - the time taken to accept the task

rejected

public void rejected(long time,
                     java.lang.Throwable throwable)
Description copied from interface: Task (src)
The task has been rejected

Specified by:
rejected in interface Task (src)
Parameters:
time - the time taken to reject the task

started

public void started(long time)
Description copied from interface: Task (src)
The task has been started

Specified by:
started in interface Task (src)
Parameters:
time - the time taken to start the task

completed

public void completed(long time,
                      java.lang.Throwable throwable)
Description copied from interface: Task (src)
The task has been completed

Specified by:
completed in interface Task (src)
Parameters:
time - the time taken to reject the task

toString

public java.lang.String toString()