Class CTSWorkerBaseProcess
- java.lang.Object
-
- org.forgerock.openam.cts.worker.process.CTSWorkerBaseProcess
-
- All Implemented Interfaces:
CTSWorkerProcess
- Direct Known Subclasses:
CTSWorkerDeleteProcess,MaxSessionTimeExpiredProcess,SessionIdleTimeExpiredProcess
public abstract class CTSWorkerBaseProcess extends Object implements CTSWorkerProcess
CTSWorkerProcessbase class handling repeated steps such as paging through query results, thread interruption and waiting for each page of results to be processed.
-
-
Constructor Summary
Constructors Constructor Description CTSWorkerBaseProcess()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidhandle(CTSWorkerQuery workerQuery, CTSWorkerFilter filter)Executes this process against the results from the provided CTSWorkerQuery, which should be filtered by the supplied CTSWorkerFilter first.protected abstract CountDownLatchhandleBatch(Collection<PartialToken> batch)Hook method allowing subclasses to define the actual work to be carried out by thisCTSWorkerProcess.protected abstract voidhandleFailed(Exception exception)Hook method called whenhandle(org.forgerock.openam.cts.impl.query.worker.CTSWorkerQuery, org.forgerock.openam.cts.worker.CTSWorkerFilter)fails to complete due to an error.protected abstract voidhandleSucceeded(org.apache.commons.lang3.time.StopWatch queryStopWatch, org.apache.commons.lang3.time.StopWatch waitingStopWatch, long total)Hook method called whenhandle(org.forgerock.openam.cts.impl.query.worker.CTSWorkerQuery, org.forgerock.openam.cts.worker.CTSWorkerFilter)completes successfully.StringtoString()
-
-
-
Method Detail
-
handle
public final void handle(CTSWorkerQuery workerQuery, CTSWorkerFilter filter)
Description copied from interface:CTSWorkerProcessExecutes this process against the results from the provided CTSWorkerQuery, which should be filtered by the supplied CTSWorkerFilter first. Thread Safety: The implementation of this processor must respond to interrupts. Operations should aim to complete quickly, and those that block must be interruptible. Once interrupted the thread will exit.- Specified by:
handlein interfaceCTSWorkerProcess- Parameters:
workerQuery- The query which has been executed on the data layer.filter- The filter to ensure this process should apply to a given element.
-
handleBatch
protected abstract CountDownLatch handleBatch(Collection<PartialToken> batch) throws CoreTokenException
Hook method allowing subclasses to define the actual work to be carried out by thisCTSWorkerProcess.- Parameters:
batch- the filtered page of query results to be processed.- Returns:
- CountDownLatch which will open once the
batchhas been processed. - Throws:
CoreTokenException- if an exception occurs while handling the batch.
-
handleSucceeded
protected abstract void handleSucceeded(org.apache.commons.lang3.time.StopWatch queryStopWatch, org.apache.commons.lang3.time.StopWatch waitingStopWatch, long total)Hook method called whenhandle(org.forgerock.openam.cts.impl.query.worker.CTSWorkerQuery, org.forgerock.openam.cts.worker.CTSWorkerFilter)completes successfully.This method can be overridden by subclasses for monitoring or debug logging.
- Parameters:
queryStopWatch- timing of the query and task spawning step.waitingStopWatch- timing of the task completion wait time.total- number of query results which matched the filter and were processed.
-
handleFailed
protected abstract void handleFailed(Exception exception)
Hook method called whenhandle(org.forgerock.openam.cts.impl.query.worker.CTSWorkerQuery, org.forgerock.openam.cts.worker.CTSWorkerFilter)fails to complete due to an error.This method can be overridden by subclasses for debug logging.
- Parameters:
exception- the exception which prevented the call tohandle(org.forgerock.openam.cts.impl.query.worker.CTSWorkerQuery, org.forgerock.openam.cts.worker.CTSWorkerFilter)from completing successfully.
-
-