Class AbstractRule
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.rules.AbstractRule
-
- All Implemented Interfaces:
IRule
- Direct Known Subclasses:
ApplicationHaltsRule
,AutoBoxingRule
,CompareCpuRule
,FewSampledThreadsRule
,GcFreedRatioRule
,GcPauseRatioRule
,StringDeduplicationRule
public abstract class AbstractRule extends java.lang.Object implements IRule
Abstract base class for rules, supplying some boiler plate code.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<TypedPreference<?>>
configAttributes
protected java.util.concurrent.FutureTask<Result>
evaluationTask
private java.lang.String
id
private java.lang.String
name
private java.lang.String
topic
-
Constructor Summary
Constructors Constructor Description AbstractRule(java.lang.String id, java.lang.String name, java.lang.String topic, TypedPreference<?>... configAttributes)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.RunnableFuture<Result>
evaluate(IItemCollection items, IPreferenceValueProvider valueProvider)
Gets a future representing the result of the evaluation of this rule.java.util.Collection<TypedPreference<?>>
getConfigurationAttributes()
Gets information about which attributes may be configured during rule evaluation.java.lang.String
getId()
java.lang.String
getName()
protected abstract Result
getResult(IItemCollection items, IPreferenceValueProvider vp)
java.lang.String
getTopic()
-
-
-
Field Detail
-
evaluationTask
protected java.util.concurrent.FutureTask<Result> evaluationTask
-
id
private final java.lang.String id
-
name
private final java.lang.String name
-
topic
private final java.lang.String topic
-
configAttributes
private final java.util.Collection<TypedPreference<?>> configAttributes
-
-
Constructor Detail
-
AbstractRule
public AbstractRule(java.lang.String id, java.lang.String name, java.lang.String topic, TypedPreference<?>... configAttributes)
-
-
Method Detail
-
getResult
protected abstract Result getResult(IItemCollection items, IPreferenceValueProvider vp)
-
evaluate
public java.util.concurrent.RunnableFuture<Result> evaluate(IItemCollection items, IPreferenceValueProvider valueProvider)
Description copied from interface:IRule
Gets a future representing the result of the evaluation of this rule. Running the RunnableFuture is the responsibility of the caller of this method, not the implementation.- Specified by:
evaluate
in interfaceIRule
- Parameters:
items
- items to evaluatevalueProvider
- Provider of configuration values used for evaluation. The attributes that will be asked for from the provider should be provided byIRule.getConfigurationAttributes()
.- Returns:
- a RunnableFuture that when run will return the evaluation result
-
getConfigurationAttributes
public java.util.Collection<TypedPreference<?>> getConfigurationAttributes()
Description copied from interface:IRule
Gets information about which attributes may be configured during rule evaluation.- Specified by:
getConfigurationAttributes
in interfaceIRule
- Returns:
- a list of configuration attributes
-
getId
public java.lang.String getId()
-
getName
public java.lang.String getName()
-
-