public interface ControllerAwarePR extends ProcessingResource
This interface should be implemented by processing resources that need to know when any containing controller starts and ends its execution, for example to initialise internal data structures or to do some aggregate processing of data gathered from a whole corpus.
If a controller contains several PRs that implement this interface,
the order in which their controllerExecutionStarted (Finished
or Aborted) methods are called is not specified. In
particular, the "ended" methods may be called in a different order
from the "started" ones. Also, if one PR throws an exception from its
controllerExecutionFinished method, the other finished
methods may not be called at all for this run. PRs should be robust
to this possibility.
If the processing resource implementing this interface is contained in
a conditional controller the methods defined by this interface are invoked
independently of the RunningStrategy for the processing resource: even if
the PR is disabled, the methods will get invoked. The method
Utils.isEnabled(Controller, ProcessingResource) can be used
inside the implementation of the methods defined in this interface
if necessary to find out if the processing resource has a chance to run
in the controller.
The controller should call this PRs started and finished (or aborted) methods at most once per run, even if the controller allows the same PR to be added multiple times.
| Modifier and Type | Method and Description |
|---|---|
void |
controllerExecutionAborted(Controller c,
Throwable t)
Called by a controller containing this PR when the controller's
execution has been aborted by an exception thrown by one of the
contained PR's
execute methods, or by the controller
itself. |
void |
controllerExecutionFinished(Controller c)
Called by a controller containing this PR when the controller's
execution has completed successfully.
|
void |
controllerExecutionStarted(Controller c)
Called by a controller containing this PR when the controller
begins executing.
|
reInitcleanup, getParameterValue, init, setParameterValue, setParameterValuesgetFeatures, setFeaturesgetName, setNameexecute, interrupt, isInterruptedvoid controllerExecutionStarted(Controller c) throws ExecutionException
executed on this run.c - the Controller that is executing.ExecutionException - if an error occurs that requires the
controller to abort its execution.void controllerExecutionFinished(Controller c) throws ExecutionException
execute method of any of this controller's PRs in
this run.c - the Controller that is executing.ExecutionException - if an error occurs that requires the
controller to abort its execution.void controllerExecutionAborted(Controller c, Throwable t) throws ExecutionException
execute methods, or by the controller
itself. When this method is called, it is guaranteed that there
will be no more calls to the execute method of any
of this controller's PRs in this run.c - the Controller that is executing.t - the Throwable that caused the controller to
abort. This will be either an ExecutionException,
a RuntimeException or an Error.ExecutionException - if an error occurs in this method that
requires the controller to abort its execution. This
method should not rethrow t, as the
controller will do this after informing any other
ControllerAware PRs it contains.Copyright © 2024 GATE. All rights reserved.