public final class AsyncServiceImpl extends API implements AsyncService
AsyncService
, provides the Java interfaces
to three of the CICS Asynchronous API commands:
AsyncService.BlockingAction
Constructor and Description |
---|
AsyncServiceImpl()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
freeChild(ChildResponse childResponse)
Free the CICS memory object representing the specified child.
|
void |
freeChild(java.util.concurrent.Future<ChildResponse> future)
Free the CICS memory object representing the specified child such that
future invocations of
Future.get() against this child (if
Future.get() has not already been issued) will fail. |
ChildResponse |
getAny()
Get the results (in the form of a
ChildResponse object) of the
first child task which returns to the issuing task. |
ChildResponse |
getAny(AsyncService.BlockingAction blockingAction)
Get the results (in the form of a
ChildResponse object) of the
first child task which returns to the issuing task. |
ChildResponse |
getAny(long timeout,
java.util.concurrent.TimeUnit unit)
Get the results (in the form of a
ChildResponse object) of the
first child task which returns to the issuing task. |
java.util.concurrent.Future<ChildResponse> |
runTransactionId(java.lang.String transactionId)
Start a child CICS task asynchronously, returning a
Future object. |
java.util.concurrent.Future<ChildResponse> |
runTransactionId(java.lang.String transactionId,
Channel channel)
Start a child CICS task asynchronously, passing a
Channel , and
returning a Future object. |
public java.util.concurrent.Future<ChildResponse> runTransactionId(java.lang.String transactionId, Channel channel) throws InvalidRequestException, InvalidTransactionIdException, ChannelErrorException, NotAuthorisedException, ResourceDisabledException
Channel
, and
returning a Future
object.
A Channel
must be specified if you expect to get a channel back
from the child.
runTransactionId
in interface AsyncService
transactionId
- the identifier of the local transaction to be startedchannel
- the Channel
object to be passed (copied) to the
child task. If this is null, no channel will be passed to the
child taskFuture
object with a promise to deliver a
ChildResponse
objectInvalidRequestException
- the started transaction is not
shutdown-enabled and the CICS region is in the process of shutting
down, or this method was run during transaction terminationInvalidTransactionIdException
- the transaction identifier specified
is not defined to CICS, or is defined as remoteChannelErrorException
- the channel specified contains an incorrect
character or combination of charactersNotAuthorisedException
- the user associated with the issuing task is
not authorized to run the child taskResourceDisabledException
- the specified transaction is disabledpublic java.util.concurrent.Future<ChildResponse> runTransactionId(java.lang.String transactionId) throws InvalidRequestException, InvalidTransactionIdException, NotAuthorisedException, ResourceDisabledException
Future
object.runTransactionId
in interface AsyncService
transactionId
- the identifier of the local transaction to be startedFuture
object with a promise to deliver a
ChildResponse
objectInvalidRequestException
- the started transaction is not
shutdown-enabled and the CICS region is in the process of shutting
down, or this method was run during transaction terminationInvalidTransactionIdException
- the transaction identifier specified
is not defined to CICS, or is defined as remoteNotAuthorisedException
- the user associated with the issuing task is
not authorized to run the child taskResourceDisabledException
- the specified transaction is disabledpublic ChildResponse getAny() throws InvalidRequestException, NotFoundException
ChildResponse
object) of the
first child task which returns to the issuing task.
This method will block the current thread until a child task completes.
getAny
in interface AsyncService
ChildResponse
object representing the results of the
first returned child taskInvalidRequestException
- the parent has no childrenNotFoundException
- no unfetched children were foundpublic ChildResponse getAny(AsyncService.BlockingAction blockingAction) throws InvalidRequestException, NotFinishedException, NotFoundException
ChildResponse
object) of the
first child task which returns to the issuing task.
This method will block the current thread until a child task completes,
unless AsyncService.BlockingAction.NOSUSPEND
is chosen as the argument.
getAny
in interface AsyncService
blockingAction
- the choice of blocking action enumerated by
AsyncService.BlockingAction
; defaults to AsyncService.BlockingAction.SUSPEND
if null is passedChildResponse
object representing the results of the
first returned child taskInvalidRequestException
- the parent has no childrenNotFinishedException
- no children have completedNotFoundException
- no unfetched children were foundpublic ChildResponse getAny(long timeout, java.util.concurrent.TimeUnit unit) throws InvalidRequestException, NotFinishedException, NotFoundException
ChildResponse
object) of the
first child task which returns to the issuing task.
This method will block the current thread until the child task completes, or the timeout expires. A maximum time of 4080000 milliseconds is supported.
getAny
in interface AsyncService
timeout
- the maximum time to waitunit
- the time unit of the timeout argumentChildResponse
object representing the results of the
first returned child taskInvalidRequestException
- the parent has no children, or the timeout
value is not validNotFinishedException
- no children have completed within the interval
specifiedNotFoundException
- no unfetched children were foundpublic void freeChild(ChildResponse childResponse) throws InvalidRequestException
freeChild
in interface AsyncService
childResponse
- object representing a returned child's resultsInvalidRequestException
- the ChildResponse
object does not
represent a valid childpublic void freeChild(java.util.concurrent.Future<ChildResponse> future) throws InvalidRequestException
Future.get()
against this child (if
Future.get()
has not already been issued) will fail.
AsyncService.getAny()
will no longer return this child.freeChild
in interface AsyncService
future
- a Future
object returned by
AsyncService.runTransactionId(String)
InvalidRequestException
- the Future
object does not
represent a valid child