public class AsyncRequestImpl extends HandleChain implements AsyncRequest, java.lang.Runnable
As some the mutable fields of this class can be modified by more than one thread, they are
marked as volatile.
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object[] |
args
The procedure's arguments.
|
private boolean |
async
Flag indicating if the request invoked on another thread or immediately.
|
private java.lang.Runnable |
asyncAction
The async action to execute.
|
private boolean |
cancelled
Flag indicating that the async call has been cancelled.
|
private boolean |
complete
Flag indicating that the async call has completed (will be
false if the call was
cancelled. |
private boolean |
error
Flag indicating that the call was terminated with an ERROR condition.
|
private java.lang.String |
eventProcedure
The name of the EVENT-PROCEDURE.
|
private WrappedResource |
eventProcedureContext
The context of the EVENT-PROCEDURE.
|
private AppServerHelper |
helper
For appserver calls, the helper for the remote connection.
|
private java.util.ArrayList<AsyncRequestListener> |
listeners
List of listeners which need to receive notifications when the call is started or finished.
|
private java.lang.String |
modes
The modes for the procedure's arguments.
|
private int |
passCount
The number of passes for the
execute(boolean) method - 1 is on the Conversation thread, 2 is on a
separate thread. |
private WrappedResource |
persistentProcedure
The proxy procedure, if the remote call is for an internal procedure.
|
private java.lang.String |
procedureName
The name of the target procedure.
|
private boolean |
quit
Flag indicating that the call was terminated with a QUIT condition.
|
private java.lang.Runnable |
request
A worker indicating what will be invoked.
|
private int |
requestId
The ID of the remote request being executed.
|
private object<? extends OerequestInfo> |
requestInfo
The reference to the REQUEST-INFO attribute.
|
private object<? extends OerequestInfo> |
responseInfo
The reference to the RESPONSE-INFO attribute.
|
private RemoteInvocationResult |
result
The result from the remote call.
|
private handle |
server
A handle to the SERVER resource.
|
private boolean |
stop
Flag indicating that the call was terminated with a STOP condition.
|
private boolean |
valid
Flag indicating if the resource is valid.
|
private boolean |
webService
Flag indicating if this is a web service call.
|
name, nextSibling, prevSibling, wainstProc, pm| Constructor and Description |
|---|
AsyncRequestImpl(handle server,
java.lang.Runnable request,
character eventProcedure,
handle eventProcedureContext,
character procedureName,
handle persistentProcedure,
java.lang.String modes,
java.lang.Object... args)
Create a new async request resource, by specifying the attributes related to the async
call definition.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
_isCancelled()
Get the
CANCELLED attribute of this async request, as a Java boolean. |
boolean |
_isComplete()
Get the
COMPLETE attribute of this async request, as a Java boolean. |
(package private) void |
cancelled()
Called when the async call was cancelled by the user.
|
(package private) void |
complete()
Called when the async call has finished normally (not with a cancel).
|
logical |
error()
Returns the state of the ERROR attribute
|
void |
error(boolean value)
Setter for ERROR attribute.
|
void |
error(logical value)
Setter for ERROR attribute.
|
(package private) void |
execute(boolean async)
Execute the async request.
|
java.lang.Object[] |
getArgs()
Get the arguments for this async requests.
|
character |
getEventProcedure()
Get the
EVENT-PROCEDURE attribute of this async request. |
handle |
getEventProcedureContext()
Get the
EVENT-PROCEDURE-CONTEXT attribute of this async request. |
java.lang.String |
getModes()
Get the parameter modes for this async request.
|
handle |
getPersistentProcedure()
Get the
PERSISTENT-PROCEDURE attribute of this async request. |
character |
getProcedureName()
Get the
PROCEDURE-NAME attribute of this async request. |
object<? extends OerequestInfo> |
getRequestInfo()
Get the REQUEST-INFO legacy attribute.
|
object<? extends OerequestInfo> |
getResponseInfo()
Get the RESPONSE-INFO legacy attribute.
|
handle |
getServerHandle()
Returns a handle to the app server in which the procedure is ran.
|
protected boolean |
hasNameReadOnly()
As this resource supports the name attribute in R/W mode, return
false |
(package private) boolean |
isAsync()
Check if the request can be executed immediately or it needs to be async.
|
logical |
isCancelled()
Get the
CANCELLED attribute of this async request. |
logical |
isComplete()
Get the
COMPLETE attribute of this async request. |
logical |
isQuit()
Get the
QUIT attribute of this async request. |
logical |
isStop()
Get the
STOP attribute of this async request. |
private void |
notifyListeners(boolean start)
Notify the listeners about the invocation request state (start or finish).
|
(package private) void |
notifyStart()
Notify all listeners that the async call is about to start.
|
(package private) void |
registerListener(AsyncRequestListener listener)
Register a new listener for notifications about the state of the async call.
|
protected boolean |
resourceDelete()
The async resource can be deleted only if it has been completed or cancelled.
|
void |
run()
Invoke the event procedure for this async request, if used.
|
(package private) void |
setAsyncAction(java.lang.Runnable action)
Set the async action to be executed for this request.
|
(package private) void |
setError()
Mark this async call as having ended with a ERROR condition.
|
(package private) void |
setQuit()
Mark this async call as having ended with a QUIT condition.
|
(package private) void |
setRequestId(int reqId)
Set the ID of this remote request.
|
(package private) void |
setResult(RemoteInvocationResult result)
Set the result from the
request execution. |
(package private) void |
setStop()
Mark this async call as having ended with a STOP condition.
|
(package private) void |
stop()
Stop this async request by sending the STOP condition to the remote side.
|
boolean |
valid()
Reports if this object is valid for use (has not been deleted).
|
_name, delete, firstResource, firstResource, getHead, getNextSibling, getNextSibling, getPrevSibling, getPrevSibling, getPrivateData, getTail, hasName, hasNameConstraints, hasNextSibling, hasParent, hasPrevSibling, hasPrivateData, interlink, isChained, lastResource, lastResource, moveInChain, name, name, name, readOnlyError, readOnlyError, resolveChainType, setHead, setNextSibling, setNextSibling, setPrevSibling, setPrevSibling, setPrivateData, setPrivateData, setPrivateData, validateName_instantiatingProcedure, addToPool, doDelete, equals, hashCode, id, id, implicitDeletion, incrementTrigger, instantiatingProcedure, invalidAttribute, processResource, registerResource, resourceType, setInstantiatingProcedure, toString, type, unableToAssignUnknown, unknownclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetNextSibling, getPrevSibling, getPrivateData, setPrivateData, setPrivateDatareadOnlyError, readOnlyError, resourceTypeid, id, unknownsetServerHandlesetEventProcedure, setEventProcedure, setEventProcedureContextallowDeleteprivate final handle server
private java.lang.String eventProcedure
private WrappedResource eventProcedureContext
private WrappedResource persistentProcedure
private java.lang.String procedureName
private final java.lang.Object[] args
private java.lang.String modes
private RemoteInvocationResult result
private volatile boolean complete
false if the call was
cancelled.private volatile boolean cancelled
private volatile boolean quit
private volatile boolean stop
private volatile boolean error
private volatile boolean valid
private volatile int requestId
private java.util.ArrayList<AsyncRequestListener> listeners
private java.lang.Runnable request
private object<? extends OerequestInfo> requestInfo
private object<? extends OerequestInfo> responseInfo
private boolean webService
private boolean async
private java.lang.Runnable asyncAction
private volatile int passCount
execute(boolean) method - 1 is on the Conversation thread, 2 is on a
separate thread.private AppServerHelper helper
public AsyncRequestImpl(handle server, java.lang.Runnable request, character eventProcedure, handle eventProcedureContext, character procedureName, handle persistentProcedure, java.lang.String modes, java.lang.Object... args)
server - The server used to invoke the remote call. May be a SERVER or the
SESSION resource.request - The request which will execute the procedure call.eventProcedure - The event procedure name.eventProcedureContext - The context of the event procedure.procedureName - The name of the procedure to be invoked.persistentProcedure - The handle to the proxy procedure to which the target procedure belongs. Will
be unknown if this is not a remote call.modes - The modes for the procedure's arguments.args - The procedure's arguments.public java.lang.String getModes()
public java.lang.Object[] getArgs()
public logical error()
public void error(boolean value)
public void error(logical value)
public boolean valid()
valid in interface WrappedResourcetrue if we are valid (can be used).public handle getServerHandle()
getServerHandle in interface Remotablepublic logical isCancelled()
CANCELLED attribute of this async request.isCancelled in interface AsyncRequestpublic boolean _isCancelled()
CANCELLED attribute of this async request, as a Java boolean.public logical isComplete()
COMPLETE attribute of this async request.isComplete in interface AsyncRequestpublic boolean _isComplete()
COMPLETE attribute of this async request, as a Java boolean.public character getEventProcedure()
EVENT-PROCEDURE attribute of this async request.getEventProcedure in interface EventProcedurepublic handle getEventProcedureContext()
EVENT-PROCEDURE-CONTEXT attribute of this async request.getEventProcedureContext in interface EventProcedurepublic handle getPersistentProcedure()
PERSISTENT-PROCEDURE attribute of this async request.getPersistentProcedure in interface AsyncRequestpublic character getProcedureName()
PROCEDURE-NAME attribute of this async request.getProcedureName in interface AsyncRequestpublic object<? extends OerequestInfo> getRequestInfo()
getRequestInfo in interface RequestResponseInfopublic object<? extends OerequestInfo> getResponseInfo()
getResponseInfo in interface RequestResponseInfopublic logical isQuit()
QUIT attribute of this async request.isQuit in interface AsyncRequestpublic logical isStop()
STOP attribute of this async request.isStop in interface AsyncRequestpublic void run()
run in interface java.lang.Runnableboolean isAsync()
async flag.void setAsyncAction(java.lang.Runnable action)
action - The async action.void setRequestId(int reqId)
reqId - The ID of the request.void complete()
void cancelled()
void setStop()
void setQuit()
void setError()
void stop()
void setResult(RemoteInvocationResult result)
request execution.result - The result.void registerListener(AsyncRequestListener listener)
listener - A listener instance.void notifyStart()
void execute(boolean async)
async - Flag indicating if the request will be executed in this thread or in another thread.protected boolean resourceDelete()
resourceDelete in class HandleResourcetrue if the resource was deleted.protected boolean hasNameReadOnly()
falsehasNameReadOnly in class HandleChainfalseprivate void notifyListeners(boolean start)
start - true to indicate invocation start, false to notify for
invocation finish.