Class ThreadedTaskListener<T>
- java.lang.Object
-
- com.identityworksllc.iiq.common.task.ThreadedTaskListener<T>
-
- Type Parameters:
T
- The type of item accepted by the task
public abstract class ThreadedTaskListener<T> extends Object
An interface allowingAbstractThreadedTask
jobs to communicate with their threads without exposing the entire task model.The thread runner can override any or all of the methods.
-
-
Constructor Summary
Constructors Constructor Description ThreadedTaskListener()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterBatch(sailpoint.api.SailPointContext threadContext)
Invoked by the default worker thread after each batch is completed.void
beforeBatch(sailpoint.api.SailPointContext threadContext)
Invoked by the default worker thread before each batch is begun.void
beforeExecution(Thread theThread, T input)
A hook that can be invoked by a worker before the action takes placestatic <X> ThreadedTaskListener<X>
defaultThreadedTaskContext()
Returns a default no-op threaded task contextvoid
handleException(Exception e)
Handles an exception during executionvoid
handleFailure(T input)
Handles a failure during execution on the given itemvoid
handleSuccess(T input)
Handles successful completion of execution on the given itemboolean
isTerminated()
Returns true if the parent task has been terminated
-
-
-
Constructor Detail
-
ThreadedTaskListener
public ThreadedTaskListener()
-
-
Method Detail
-
defaultThreadedTaskContext
public static <X> ThreadedTaskListener<X> defaultThreadedTaskContext()
Returns a default no-op threaded task context- Type Parameters:
X
- The expected type (usually inferred)- Returns:
- The resulting no-op threaded task context
-
afterBatch
public void afterBatch(sailpoint.api.SailPointContext threadContext) throws sailpoint.tools.GeneralException
Invoked by the default worker thread after each batch is completed.This can be overridden by a subclass to do arbitrary cleanup.
- Parameters:
threadContext
- The context for this thread- Throws:
sailpoint.tools.GeneralException
- if anything goes wrong
-
beforeBatch
public void beforeBatch(sailpoint.api.SailPointContext threadContext) throws sailpoint.tools.GeneralException
Invoked by the default worker thread before each batch is begun.If this method throws an exception, the batch worker ought to prevent the batch from being executed.
- Parameters:
threadContext
- The context for this thread- Throws:
sailpoint.tools.GeneralException
- if any failures occur
-
beforeExecution
public void beforeExecution(Thread theThread, T input)
A hook that can be invoked by a worker before the action takes place- Parameters:
theThread
- The currently executing threadinput
- The input record being processed
-
handleException
public void handleException(Exception e)
Handles an exception during execution- Parameters:
e
- the exception
-
handleFailure
public void handleFailure(T input)
Handles a failure during execution on the given item- Parameters:
input
- The input
-
handleSuccess
public void handleSuccess(T input)
Handles successful completion of execution on the given item- Parameters:
input
- The input
-
isTerminated
public boolean isTerminated()
Returns true if the parent task has been terminated- Returns:
- Terminated status
-
-