Class WorkCoordinator
- java.lang.Object
-
- com.sun.enterprise.connectors.work.WorkCoordinator
-
public final class WorkCoordinator extends Object
WorkCoordinator : Coordinates one work's execution. Handles all exception conditions and does JTS coordination.- Author:
- Binod P.G
-
-
Constructor Summary
Constructors Constructor Description WorkCoordinator(jakarta.resource.spi.work.Work work, long timeout, jakarta.resource.spi.work.ExecutionContext ec, com.sun.corba.ee.spi.threadpool.WorkQueue queue, jakarta.resource.spi.work.WorkListener listener, WorkManagementProbeProvider probeProvider, ConnectorRuntime runtime, String raName, WorkContextHandlerImpl handler)
Constructs a coordinator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description jakarta.resource.spi.work.WorkException
getException()
Retrieves the exception created during the work's execution.static jakarta.resource.spi.work.ExecutionContext
getExecutionContext(jakarta.resource.spi.work.ExecutionContext ec, jakarta.resource.spi.work.Work work)
String
getRAName()
int
getState()
Retrieves the state of the work coordinator object.static int
increaseSeed()
boolean
isTimedOut()
void
lock()
Lock the thread upto the end of execution or start of work execution.void
postInvoke()
Post-invoke operation.void
preInvoke()
Pre-invoke operation.boolean
proceed()
Checks the work is good to proceed with further processing.void
setException(Throwable e)
Accepts an exception object and converts to aWorkException
object.void
setState(int state)
Sets the state of the work coordinator objectvoid
setupContext(OneWork oneWork)
void
submitWork(int waitModeValue)
Submits the work to the queue and generates a work accepted event.String
toString()
Returns the string representation of WorkCoordinator.
-
-
-
Constructor Detail
-
WorkCoordinator
public WorkCoordinator(jakarta.resource.spi.work.Work work, long timeout, jakarta.resource.spi.work.ExecutionContext ec, com.sun.corba.ee.spi.threadpool.WorkQueue queue, jakarta.resource.spi.work.WorkListener listener, WorkManagementProbeProvider probeProvider, ConnectorRuntime runtime, String raName, WorkContextHandlerImpl handler)
Constructs a coordinator- Parameters:
work
- A work object as submitted by the resource adaptertimeout
- timeout for the work instanceec
- ExecutionContext object.queue
- WorkQueue of the threadpool, to which the work will be submittedlistener
- WorkListener object from the resource adapter.
-
-
Method Detail
-
getRAName
public String getRAName()
-
submitWork
public void submitWork(int waitModeValue)
Submits the work to the queue and generates a work accepted event.
-
preInvoke
public void preInvoke()
Pre-invoke operation. This does the following1. Notifies the
WorkManager.startWork
method. 2. Checks whether the wok has already been timed out. 3. Recreates the transaction with JTS.
-
setupContext
public void setupContext(OneWork oneWork) throws jakarta.resource.spi.work.WorkException
- Throws:
jakarta.resource.spi.work.WorkException
-
postInvoke
public void postInvoke()
Post-invoke operation. This does the following after the work is executed.1. Releases the transaction with JTS. 2. Generates work completed event. 3. Clear the thread context.
-
proceed
public boolean proceed()
Checks the work is good to proceed with further processing.- Returns:
- true if the work is good and false if it is bad.
-
isTimedOut
public boolean isTimedOut()
-
getException
public jakarta.resource.spi.work.WorkException getException()
Retrieves the exception created during the work's execution.- Returns:
- a
WorkException
object.
-
setException
public void setException(Throwable e)
Accepts an exception object and converts to aWorkException
object.- Parameters:
e
- Throwable object.
-
lock
public void lock()
Lock the thread upto the end of execution or start of work execution.
-
toString
public String toString()
Returns the string representation of WorkCoordinator.
-
setState
public void setState(int state)
Sets the state of the work coordinator object- Parameters:
state
- CREATED or Either STARTED or COMPLETED or TIMEDOUT
-
getState
public int getState()
Retrieves the state of the work coordinator object.- Returns:
- Integer represnting the state.
-
getExecutionContext
public static jakarta.resource.spi.work.ExecutionContext getExecutionContext(jakarta.resource.spi.work.ExecutionContext ec, jakarta.resource.spi.work.Work work)
-
increaseSeed
public static int increaseSeed()
-
-