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.WorkExceptiongetException()Retrieves the exception created during the work's execution.static jakarta.resource.spi.work.ExecutionContextgetExecutionContext(jakarta.resource.spi.work.ExecutionContext ec, jakarta.resource.spi.work.Work work)StringgetRAName()intgetState()Retrieves the state of the work coordinator object.static intincreaseSeed()booleanisTimedOut()voidlock()Lock the thread upto the end of execution or start of work execution.voidpostInvoke()Post-invoke operation.voidpreInvoke()Pre-invoke operation.booleanproceed()Checks the work is good to proceed with further processing.voidsetException(Throwable e)Accepts an exception object and converts to aWorkExceptionobject.voidsetState(int state)Sets the state of the work coordinator objectvoidsetupContext(OneWork oneWork)voidsubmitWork(int waitModeValue)Submits the work to the queue and generates a work accepted event.StringtoString()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.startWorkmethod. 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
WorkExceptionobject.
-
setException
public void setException(Throwable e)
Accepts an exception object and converts to aWorkExceptionobject.- 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()
-
-