T - the concrete RuntimePlatform subclass type containing the actionpublic abstract class RuntimeArtifactAction<T extends RuntimePlatform> extends RuntimeAction<T>
RuntimeAction.
RuntimePlatform,
RuntimeContexts| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MESSAGE_DELAY
The default value of the
MESSAGE_DELAY_KEY configuration key (0). |
static String |
MESSAGE_DELAY_KEY
The
Configuration key used to specify the delay (in milliseconds)
before sending a message. |
runtimePlatform, session| Constructor and Description |
|---|
RuntimeArtifactAction(T runtimePlatform,
XatkitSession session)
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
beforeDelay(int delayValue)
A hook that is executed before any delay specified by
MESSAGE_DELAY_KEY. |
RuntimeActionResult |
call()
Runs the
RuntimeArtifactAction and returns its result wrapped in a RuntimeActionResult. |
protected abstract XatkitSession |
getClientSession()
Returns the
XatkitSession associated to the client of the artifact to send. |
void |
init()
Retrieve the
XatkitSession associated to the client of the artifact and merges it with the current one. |
compute, getSessionpublic static String MESSAGE_DELAY_KEY
Configuration key used to specify the delay (in milliseconds)
before sending a message.
This property is set by default to 0, meaning that the bot sends message directly when they are ready.
DEFAULT_MESSAGE_DELAYpublic static int DEFAULT_MESSAGE_DELAY
MESSAGE_DELAY_KEY configuration key (0).MESSAGE_DELAY_KEYpublic RuntimeArtifactAction(T runtimePlatform, XatkitSession session)
runtimePlatform - the RuntimePlatform containing this actionsession - the XatkitSession associated to this actionNullPointerException - if the provided runtimePlatform or session is nullXatkitSession,
RuntimeContextspublic void init()
XatkitSession associated to the client of the artifact and merges it with the current one.
This method relies on getClientSession() to retrieve the XatkitSession associated to the
client of the artifact, and merges the current session with the client one if they are different.
This allows to pass client-independent context variables (e.g. from RuntimeEventProviders)
to new client sessions.
init in class RuntimeAction<T extends RuntimePlatform>XatkitException - if the provided session is different from the getClientSession() and
the merge operation between the contexts failedpublic RuntimeActionResult call()
RuntimeArtifactAction and returns its result wrapped in a RuntimeActionResult.
This method handles IOExceptions by trying to send again the artifact after waiting <number_of_retries>*500 ms, in case the issue is related to network stability. The default number of retries
is 3. If the artifact cannot be sent after 3 retries the thrown IOException is wrapped
in the returned RuntimeActionResult and handled as a regular exception.
The returned RuntimeActionResult.getExecutionTime() value includes all the attempts to send the artifact.
This method should not be called manually, and is handled by the ExecutionService component that
manages and executes RuntimeActions.
This method does not throw any Exception if the underlying RuntimeAction's computation does not
complete. Exceptions thrown during the RuntimeArtifactAction's computation can be accessed through the
RuntimeActionResult.getThrownException() method.
call in interface Callable<RuntimeActionResult>call in class RuntimeAction<T extends RuntimePlatform>RuntimeActionResult containing the raw result of the computation and monitoring informationExecutionService,
RuntimeActionResultprotected void beforeDelay(int delayValue)
MESSAGE_DELAY_KEY.
This method can be extended by concrete sub-classes if an action must be performed before a potential delay (e .g. notifying a client application to display writing dots).
delayValue - the value of the delay (in ms)protected abstract XatkitSession getClientSession()
XatkitSession associated to the client of the artifact to send.
This method is used by the RuntimeArtifactAction constructor to pass client-independent context
variables (e.g. from RuntimeEventProviders) to the client session.
XatkitSession associated to the client of the artifact to sendCopyright © 2020 SOM Research Lab. All rights reserved.