public interface SweepActionHandler
A custom sweep handler is invoked by a custom sweep object -- either a
CmCustomSweepJob
,
CmCustomSweepPolicy
, or
CmCustomQueueSweep
.
After the sweep retrieves instances of a target class,
like Document
or Annotation
, the sweep passes the instances
to the custom sweep handler.
The handler processes the instances according to the behavior defined by its implementer.
For example, a CmCustomSweepJob
could sweep for all documents of a specified class and pass the retrieved instances to the custom
SweepActionHandler
implementation. The implementation could then change the class of the documents.
Important: While a SweepActionHandler
implementation can alter or delete objects
returned by CmCustomSweepJob
or CmCustomSweepPolicy
,
it must not attempt to alter queue objects returned by CmCustomQueueSweep
.
The sweep framework is responsible for selecting, leasing, updating, and deleting queue objects.
The SweepActionHandler
must not perform operations on queue objects that might conflict with the sweep framework.
Doing so can result in database deadlocks, timeouts, or slow performance.
When implementing a sweep handler, consider the following points:
CodeModule
object.Modifier and Type | Interface and Description |
---|---|
static interface |
SweepActionHandler.SweepItem
A subinterface for getting an instance of a class targeted by a custom sweep
(
CmCustomQueueJob , CmCustomSweepPolicy , or CmCustomQueueSweep ). |
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getRequiredProperties()
Returns an array of names specifying the properties to be automatically fetched for processing by the handler.
|
void |
onPolicySweep(CmSweep sweepObject,
CmSweepPolicy sweepPolicy,
SweepActionHandler.SweepItem[] sweepItems)
Invoked when a custom sweep policy passes instances of a target class to the custom sweep handler.
|
void |
onSweep(CmSweep sweepObject,
SweepActionHandler.SweepItem[] sweepItems)
Invoked when a custom sweep job or queue sweep passes instances of a target class to the custom sweep handler.
|
void onSweep(CmSweep sweepObject, SweepActionHandler.SweepItem[] sweepItems)
sweepObject
- The custom sweep (CmCustomSweepJob
or CmCustomQueueSweep
) that invoked this method.
Note that this custom sweep object that's passed to this method does not necessarily reflect the current state of counter properties
(examined, processed, and failed counts).sweepItems
- An array of SweepItem
objects that contains instances of the target class retrieved by the sweep service.void onPolicySweep(CmSweep sweepObject, CmSweepPolicy sweepPolicy, SweepActionHandler.SweepItem[] sweepItems)
sweepObject
- The policy controlled sweep (CmPolicyControlledSweep
) that invoked this method.
Note that this policy controlled sweep that's passed to this method does not necessarily reflect the current state of counter properties
(examined, processed, and failed counts).sweepPolicy
- The custom sweep policy (CmCustomSweepPolicy
) associated with the policy controlled sweep
that invoked this method. Note that the custom sweep policy that's passed to this method does not necessarily the current state
of counter properties (examined, processed, and failed counts).sweepItems
- An array of SweepItem
objects that contains instances of the target class retrieved by
the sweep service.java.lang.String[] getRequiredProperties()
Specify only the properties that are required by the handler, and the server will return only those properties and a set of system properties. Limiting the set of properties to only what's required by the handler allows you to create a covering database index on just those properties, and the sweep service will more efficiently retrieve objects from the database.
If you return an empty array, then all properties are fetched. If the handler attempts to access an unfetched property,
a API_PROPERTY_NOT_IN_CACHE
exception is thrown.
The method is called automatically when the handler is invoked by a custom sweep job or sweep policy. It is not called when the handler is invoked by a custom queue sweep.
© Copyright IBM Corporation 2006, 2015. All rights reserved.