io.sarl.sre.janus.services.executor.tasks
Class SreExecutable
All Known Subclasses:
SreCallable<T>, SreConsumer<T>, SreRunnable
@org.eclipse.xtext.xbase.lib.XbaseGenerated
abstract class SreExecutable
extends java.lang.Object
Abstract implementation of a task that could be run on the JRE executor service. See Runnables for creating an instance.
Maven Group Identifier:
io.sarl.sre.janus
Maven Artifact Identifier:
janus.kernel
Since:
0.6
See:
Runnables
Property Summary
Modifier and type Property and description
java.lang.Throwable exception
Replies the exception that has stopped the task.
java.util.logging.Logger logger
Replies the logger.
Field Summary
Modifier and type Field and description
protected var volatile java.lang.Throwable exception
Constructor Summary
Constructor and description
new(Logger)
Constructor.
Action Summary
Modifier and type Action and description
protected static java.lang.String exceptionMessage(Throwable)
Replies a not-empty message for the given exception.
java.lang.Throwable getException
Replies the exception that has stopped the task.
java.util.logging.Logger getLogger
Replies the logger.
protected static java.lang.Throwable getRootCause(Throwable)
Replies the root cause of the given exception.
boolean isSuccess
Replies if the task was finished on a success.
protected boolean onError(Throwable)
Invoked when an error occurs into the task and after this error is logged out.
protected void onFinished
Invoked when the task is finished whatever it is successful or failing.
Property Details
exception
val exception : java.lang.Throwable
Replies the exception that has stopped the task.

This property is an alias for the action: getException

Returns:
the exception or null if the task was successfully finished.
Since:
0.11
logger
val logger : java.util.logging.Logger
Replies the logger.

This property is an alias for the action: getLogger

Returns:
the logger, or null if the platform logger should be used.
Field Details
exception
protected var volatile exception : java.lang.Throwable
Constructor Details
new(Logger)
protected new(Logger)
Constructor. See Runnables for creating an instance.
Parameters:
logger - the logger to use.
Action Details
exceptionMessage(Throwable)
protected def exceptionMessage(Throwable) : java.lang.String
Replies a not-empty message for the given exception.
Parameters:
ex - the exception.
Returns:
the error message.
getException
def getException : java.lang.Throwable
Replies the exception that has stopped the task.
Returns:
the exception or null if the task was successfully finished.
Since:
0.11
getLogger
def getLogger : java.util.logging.Logger
Replies the logger.
Returns:
the logger, or null if the platform logger should be used.
getRootCause(Throwable)
protected def getRootCause(Throwable) : java.lang.Throwable
Replies the root cause of the given exception.
Parameters:
ex - the exception for which the root cause msut be determined.
Returns:
the root cause, never null.
isSuccess
def isSuccess : boolean
Replies if the task was finished on a success.
Returns:
true if the task if finished and successful. false if the task is not not finished or successful.
onError(Throwable)
protected def onError(Throwable) : boolean
Invoked when an error occurs into the task and after this error is logged out. The default implementation does nothing.
Parameters:
error - the error.
Returns:
true if the error should be thrown in the current thread. false if the exception is not thrown.
Since:
0.11
onFinished
protected def onFinished
Invoked when the task is finished whatever it is successful or failing. The default implementation does nothing.
Since:
0.11