public class HintScanPrioritizer extends Object implements ScanPrioritizer
Scanners should put the key/value priority=<integer>
in the map passed to
ScannerBase.setExecutionHints(Map)
to set the priority. Lower integers result in higher
priority.
This prioritizer accepts the option default_priority=<integer>
which determines what
priority to use for scans without a hint. If not set, then default_priority
is
Integer.MAX_VALUE
.
This prioritizer accepts the option bad_hint_action=fail|log|none
. This option determines
what happens when a priority hint is not an integer. It defaults to log
which logs a
warning. The fail
option throws an exception which may fail the scan. The none
option silently ignores invalid hints.
When two scans have the same priority, the scan is prioritized based on last run time and then creation time.
If a secondary or tertiary priority is needed, this can be done with bit shifting. For example
assume a primary priority of 1 to 3 is desired followed by a secondary priority of 1 to 10 . This
can be encoded as int priority = primary << 4 | secondary
. When the primary bits are
equal the comparison naturally falls back to the secondary bits. The example does not handle the
case where the primary of secondary priorities are outside expected ranges.
ScanPrioritizer.CreateParameters
Constructor and Description |
---|
HintScanPrioritizer() |
Modifier and Type | Method and Description |
---|---|
Comparator<ScanInfo> |
createComparator(ScanPrioritizer.CreateParameters params) |
public Comparator<ScanInfo> createComparator(ScanPrioritizer.CreateParameters params)
createComparator
in interface ScanPrioritizer
Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.