public abstract class ManipulatorRuntime extends PipelineComponentRuntime
ManipulatorRuntime
is created
for each manipulator instance in every acquisition.
The general life cycle of a ManipulatorRuntime is:
Manipulator.createManipulatorRuntime(PipelineComponentConfiguration, PipelineComponentRuntimeContext)
.checkFullAcquisitionRequired()
is called to ensure that the runtime has the necessary state to support an incremental acquisition.prepareForAcquisition(AcquisitionMode)
to perform any runtime initialization
that requires the AcquisitionMode.processRecord(Record)
is called for every input record.onInputClose()
is called after the runtime has processed all input records.PipelineComponentRuntime.endAcquisition(AcquisitionEndState)
is called to clean up any resources used by
the runtime.Subclasses must be thread-safe. The CAS Server will invoke methods on this class from multiple-threads and potentially concurrently. Access to any mutable state must be properly synchronized. See the CAS Extension API Guide for more information about threading.
Constructor and Description |
---|
ManipulatorRuntime(PipelineComponentRuntimeContext context) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkFullAcquisitionRequired()
Indicates whether a full acquisition is required based on the state
maintained by the
ManipulatorRuntime . |
void |
onInputClose()
Performs any post-processing necessary once
processRecord()
has been called and has returned for the last time. |
void |
prepareForAcquisition(AcquisitionMode mode)
Performs any preparation necessary before acquisition starts.
|
abstract void |
processRecord(Record record)
Applies the manipulation to the given record.
|
endAcquisition, getContext, stop
public ManipulatorRuntime(PipelineComponentRuntimeContext context)
public boolean checkFullAcquisitionRequired()
ManipulatorRuntime
.
If CAS has already determined that a full acquisition is required, this method will not be called. For example, CAS will not call this method if the pipeline has never been run or if a configuration change requires full acquisition.
The default implementation of this method returns false indicating a full acquisition is not required.
PipelineComponentConfiguration.isFullAcquisitionRequired(PipelineComponentConfiguration)
public void prepareForAcquisition(AcquisitionMode mode) throws FatalExecutionException
mode
- indicates whether the acquisition is full or incrementalFatalExecutionException
- if preparation failed,
and no processing of any records should take place.public abstract void processRecord(Record record) throws ExecutionException
OutputChannel
obtained from the
PipelineComponentRuntimeContext
. The CAS Server performs no
further processing on Records that are not output.
The CAS Server invokes this method concurrently for multiple records, so implementations must be thread-safe.
If a java RuntimeException or an ExecutionException
that is not a FatalExecutionException
is thrown, CAS discards the record using the ErrorChannel
.
record
- the record to be processedExecutionException
- if processing of this record failed,
but that further processing of other records may continue normally.FatalExecutionException
- if processing of the current record
failed, and no further processing of any records should continue.PipelineComponentRuntime.stop()
public void onInputClose() throws FatalExecutionException
processRecord()
has been called and has returned for the last time. The
ManipulatorRuntime
can still
output records in this method.
Any Exceptions thrown from this method, including RuntimeExceptions, cause the acquisition to fail.
FatalExecutionException
- if post-processing failed,
and no further processing of any records should continue.PipelineComponentRuntime.stop()
Copyright © 2007, 2015, Oracle and/or its affiliates. All rights reserved.