Package org.drools.core
Class RuleBaseConfiguration
- java.lang.Object
-
- org.drools.core.RuleBaseConfiguration
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,org.kie.api.conf.KieBaseOptionsConfiguration,org.kie.api.KieBaseConfiguration,org.kie.api.PropertiesConfiguration
public class RuleBaseConfiguration extends java.lang.Object implements org.kie.api.KieBaseConfiguration, java.io.ExternalizableAvailable configuration options:drools.maintainTms = <true|false> drools.sequential = <true|false> drools.sequential.agenda = <sequential|dynamic> drools.removeIdentities = <true|false> drools.shareAlphaNodes = <true|false> drools.shareBetaNodes = <true|false> drools.alphaNodeHashingThreshold = <1...n> drools.alphaNodeRangeIndexThreshold = <1...n> drools.betaNodeRangeIndexEnabled = <true|false> drools.sessionPool = <1...n> drools.compositeKeyDepth = <1..3> drools.indexLeftBetaMemory = <true/false> drools.indexRightBetaMemory = <true/false> drools.equalityBehavior = <identity|equality> drools.conflictResolver = <qualified class name> drools.consequenceExceptionHandler = <qualified class name> drools.ruleBaseUpdateHandler = <qualified class name> drools.sessionClock = <qualified class name> drools.mbeans = <enabled|disabled> drools.classLoaderCacheEnabled = <true|false> drools.declarativeAgendaEnabled = <true|false> drools.permgenThreshold = <1...n> drools.jittingThreshold = <1...n>
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRuleBaseConfiguration.AssertBehaviourstatic classRuleBaseConfiguration.SequentialAgenda
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_PHREAKstatic booleanDEFAULT_SESSION_CACHEstatic java.lang.StringDEFAULT_SIGN_ON_SERIALIZATIONprotected static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description RuleBaseConfiguration()Creates a new rulebase with a default parent class loader set according to the following algorithm: If a Thread.currentThread().getContextClassLoader() returns a non-null class loader, it will be used as the parent class loader for this rulebase class loaders, otherwise, the RuleBaseConfiguration.class.getClassLoader() class loader will be used.RuleBaseConfiguration(java.lang.ClassLoader... classLoaders)A constructor that sets the parent classloader to be used while dealing with this rule baseRuleBaseConfiguration(java.util.Properties properties)Creates a new rulebase configuration using the provided properties as configuration options.RuleBaseConfiguration(java.util.Properties properties, java.lang.ClassLoader... classLoaders)A constructor that sets the classloader to be used as the parent classloader of this rule base classloaders, and the properties to be used as base configuration options
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddActivationListener(java.lang.String name, ActivationListenerFactory factory)voidenforceSingleThreadEvaluation()ActivationListenerFactorygetActivationListenerFactory(java.lang.String name)AgendaGroupFactorygetAgendaGroupFactory()intgetAlphaNodeHashingThreshold()intgetAlphaNodeRangeIndexThreshold()RuleBaseConfiguration.AssertBehaviourgetAssertBehaviour()org.kie.internal.utils.ChainedPropertiesgetChainedProperties()java.lang.ClassLoadergetClassLoader()intgetCompositeKeyDepth()java.lang.StringgetConsequenceExceptionHandler()static RuleBaseConfigurationgetDefaultInstance()org.kie.api.conf.EventProcessingOptiongetEventProcessingMode()org.kie.internal.conf.IndexPrecedenceOptiongetIndexPrecedenceOption()intgetJittingThreshold()intgetMaxThreads()Returns the configured number of maximum threads to use for concurrent propagation when multi-thread evaluation is enabled.<T extends org.kie.api.conf.SingleValueKieBaseOption>
TgetOption(java.lang.Class<T> option)<T extends org.kie.api.conf.MultiValueKieBaseOption>
TgetOption(java.lang.Class<T> option, java.lang.String key)intgetPermGenThreshold()java.lang.StringgetProperty(java.lang.String name)java.lang.StringgetRuleBaseUpdateHandler()RuleBaseConfiguration.SequentialAgendagetSequentialAgenda()intgetSessionPoolSize()java.util.List<java.util.Map<java.lang.String,java.lang.Object>>getWorkDefinitions()booleanisAdvancedProcessRuleIntegration()booleanisBetaNodeRangeIndexEnabled()booleanisDeclarativeAgenda()booleanisImmutable()Returns true if this configuration object is immutable or false otherwise.booleanisIndexLeftBetaMemory()booleanisIndexRightBetaMemory()booleanisMaintainTms()booleanisMBeansEnabled()Returns true if the management and monitoring through MBeans is activebooleanisMultithreadEvaluation()Returns true if the partitioning of the rulebase is enabled and false otherwise.booleanisMutabilityEnabled()booleanisRemoveIdentities()booleanisSequential()booleanisShareAlphaNodes()booleanisShareBetaNodes()voidmakeImmutable()Makes the configuration object immutable.voidreadExternal(java.io.ObjectInput in)voidsetAdvancedProcessRuleIntegration(boolean advancedProcessRuleIntegration)voidsetAlphaNodeHashingThreshold(int alphaNodeHashingThreshold)voidsetAlphaNodeRangeIndexThreshold(int alphaNodeRangeIndexThreshold)voidsetAssertBehaviour(RuleBaseConfiguration.AssertBehaviour assertBehaviour)voidsetBetaNodeRangeIndexEnabled(boolean betaNodeRangeIndexEnabled)voidsetClassLoader(java.lang.ClassLoader classLoader)voidsetCompositeKeyDepth(int compositeKeyDepth)voidsetConsequenceExceptionHandler(java.lang.String consequenceExceptionHandler)voidsetDeclarativeAgendaEnabled(boolean enabled)Enable declarative agendavoidsetEventProcessingMode(org.kie.api.conf.EventProcessingOption mode)voidsetIndexLeftBetaMemory(boolean indexLeftBetaMemory)voidsetIndexPrecedenceOption(org.kie.internal.conf.IndexPrecedenceOption precedence)voidsetIndexRightBetaMemory(boolean indexRightBetaMemory)voidsetJittingThreshold(int jittingThreshold)voidsetMaintainTms(boolean maintainTms)voidsetMaxThreads(int maxThreads)If multi-thread evaluation is enabled, this parameter configures the maximum number of threads each session can use for concurrent Rete propagation.voidsetMBeansEnabled(boolean mbeansEnabled)Defines if the RuleBase should expose management and monitoring MBeansvoidsetMultithreadEvaluation(boolean enableMultithread)Defines if the RuleBase should be executed using a pool of threads for evaluating the rules ("true"), or if the rulebase should work in classic single thread mode ("false").voidsetMutabilityEnabled(boolean mutabilityEnabled)<T extends org.kie.api.conf.KieBaseOption>
voidsetOption(T option)voidsetPermGenThreshold(int permGenThreshold)voidsetProperty(java.lang.String name, java.lang.String value)voidsetRemoveIdentities(boolean removeIdentities)voidsetRuleBaseUpdateHandler(java.lang.String ruleBaseUpdateHandler)voidsetSequential(boolean sequential)voidsetSequentialAgenda(RuleBaseConfiguration.SequentialAgenda sequentialAgenda)voidsetSessionPoolSize(int sessionPoolSize)voidsetShareAlphaNodes(boolean shareAlphaNodes)voidsetShareBetaNodes(boolean shareBetaNodes)voidwriteExternal(java.io.ObjectOutput out)
-
-
-
Field Detail
-
DEFAULT_PHREAK
public static final boolean DEFAULT_PHREAK
- See Also:
- Constant Field Values
-
DEFAULT_SESSION_CACHE
public static final boolean DEFAULT_SESSION_CACHE
- See Also:
- Constant Field Values
-
DEFAULT_SIGN_ON_SERIALIZATION
public static final java.lang.String DEFAULT_SIGN_ON_SERIALIZATION
- See Also:
- Constant Field Values
-
logger
protected static final transient org.slf4j.Logger logger
-
-
Constructor Detail
-
RuleBaseConfiguration
public RuleBaseConfiguration(java.util.Properties properties)
Creates a new rulebase configuration using the provided properties as configuration options. Also, if a Thread.currentThread().getContextClassLoader() returns a non-null class loader, it will be used as the parent classloader for this rulebase class loaders, otherwise, the RuleBaseConfiguration.class.getClassLoader() class loader will be used.- Parameters:
properties-
-
RuleBaseConfiguration
public RuleBaseConfiguration()
Creates a new rulebase with a default parent class loader set according to the following algorithm: If a Thread.currentThread().getContextClassLoader() returns a non-null class loader, it will be used as the parent class loader for this rulebase class loaders, otherwise, the RuleBaseConfiguration.class.getClassLoader() class loader will be used.
-
RuleBaseConfiguration
public RuleBaseConfiguration(java.lang.ClassLoader... classLoaders)
A constructor that sets the parent classloader to be used while dealing with this rule base- Parameters:
classLoaders-
-
RuleBaseConfiguration
public RuleBaseConfiguration(java.util.Properties properties, java.lang.ClassLoader... classLoaders)A constructor that sets the classloader to be used as the parent classloader of this rule base classloaders, and the properties to be used as base configuration options- Parameters:
classLoaders-properties-
-
-
Method Detail
-
getDefaultInstance
public static RuleBaseConfiguration getDefaultInstance()
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
setProperty
public void setProperty(java.lang.String name, java.lang.String value)- Specified by:
setPropertyin interfaceorg.kie.api.PropertiesConfiguration
-
getProperty
public java.lang.String getProperty(java.lang.String name)
- Specified by:
getPropertyin interfaceorg.kie.api.PropertiesConfiguration
-
makeImmutable
public void makeImmutable()
Makes the configuration object immutable. Once it becomes immutable, there is no way to make it mutable again. This is done to keep consistency.
-
isImmutable
public boolean isImmutable()
Returns true if this configuration object is immutable or false otherwise.- Returns:
-
setSequential
public void setSequential(boolean sequential)
-
isSequential
public boolean isSequential()
-
isMaintainTms
public boolean isMaintainTms()
-
setMaintainTms
public void setMaintainTms(boolean maintainTms)
-
isRemoveIdentities
public boolean isRemoveIdentities()
-
setRemoveIdentities
public void setRemoveIdentities(boolean removeIdentities)
-
isShareAlphaNodes
public boolean isShareAlphaNodes()
-
setShareAlphaNodes
public void setShareAlphaNodes(boolean shareAlphaNodes)
-
isShareBetaNodes
public boolean isShareBetaNodes()
-
setShareBetaNodes
public void setShareBetaNodes(boolean shareBetaNodes)
-
getPermGenThreshold
public int getPermGenThreshold()
-
setPermGenThreshold
public void setPermGenThreshold(int permGenThreshold)
-
getJittingThreshold
public int getJittingThreshold()
-
setJittingThreshold
public void setJittingThreshold(int jittingThreshold)
-
getAlphaNodeHashingThreshold
public int getAlphaNodeHashingThreshold()
-
setAlphaNodeHashingThreshold
public void setAlphaNodeHashingThreshold(int alphaNodeHashingThreshold)
-
getAlphaNodeRangeIndexThreshold
public int getAlphaNodeRangeIndexThreshold()
-
setAlphaNodeRangeIndexThreshold
public void setAlphaNodeRangeIndexThreshold(int alphaNodeRangeIndexThreshold)
-
isBetaNodeRangeIndexEnabled
public boolean isBetaNodeRangeIndexEnabled()
-
setBetaNodeRangeIndexEnabled
public void setBetaNodeRangeIndexEnabled(boolean betaNodeRangeIndexEnabled)
-
getSessionPoolSize
public int getSessionPoolSize()
-
setSessionPoolSize
public void setSessionPoolSize(int sessionPoolSize)
-
getAssertBehaviour
public RuleBaseConfiguration.AssertBehaviour getAssertBehaviour()
-
setAssertBehaviour
public void setAssertBehaviour(RuleBaseConfiguration.AssertBehaviour assertBehaviour)
-
getEventProcessingMode
public org.kie.api.conf.EventProcessingOption getEventProcessingMode()
-
setEventProcessingMode
public void setEventProcessingMode(org.kie.api.conf.EventProcessingOption mode)
-
getCompositeKeyDepth
public int getCompositeKeyDepth()
-
setCompositeKeyDepth
public void setCompositeKeyDepth(int compositeKeyDepth)
-
isIndexLeftBetaMemory
public boolean isIndexLeftBetaMemory()
-
setIndexLeftBetaMemory
public void setIndexLeftBetaMemory(boolean indexLeftBetaMemory)
-
isIndexRightBetaMemory
public boolean isIndexRightBetaMemory()
-
setIndexRightBetaMemory
public void setIndexRightBetaMemory(boolean indexRightBetaMemory)
-
getIndexPrecedenceOption
public org.kie.internal.conf.IndexPrecedenceOption getIndexPrecedenceOption()
-
setIndexPrecedenceOption
public void setIndexPrecedenceOption(org.kie.internal.conf.IndexPrecedenceOption precedence)
-
getConsequenceExceptionHandler
public java.lang.String getConsequenceExceptionHandler()
-
setConsequenceExceptionHandler
public void setConsequenceExceptionHandler(java.lang.String consequenceExceptionHandler)
-
getRuleBaseUpdateHandler
public java.lang.String getRuleBaseUpdateHandler()
-
setRuleBaseUpdateHandler
public void setRuleBaseUpdateHandler(java.lang.String ruleBaseUpdateHandler)
-
getAgendaGroupFactory
public AgendaGroupFactory getAgendaGroupFactory()
-
getSequentialAgenda
public RuleBaseConfiguration.SequentialAgenda getSequentialAgenda()
-
setSequentialAgenda
public void setSequentialAgenda(RuleBaseConfiguration.SequentialAgenda sequentialAgenda)
-
setMultithreadEvaluation
public void setMultithreadEvaluation(boolean enableMultithread)
Defines if the RuleBase should be executed using a pool of threads for evaluating the rules ("true"), or if the rulebase should work in classic single thread mode ("false").- Parameters:
enableMultithread- true for multi-thread or false for single-thread. Default is false.
-
enforceSingleThreadEvaluation
public void enforceSingleThreadEvaluation()
-
isMultithreadEvaluation
public boolean isMultithreadEvaluation()
Returns true if the partitioning of the rulebase is enabled and false otherwise. Default is false.- Returns:
-
setMaxThreads
public void setMaxThreads(int maxThreads)
If multi-thread evaluation is enabled, this parameter configures the maximum number of threads each session can use for concurrent Rete propagation.- Parameters:
maxThreads- the maximum number of threads to use. If 0 or a negative number is set, the engine will use number of threads equal to the number of partitions in the rule base. Default number of threads is 0.
-
getMaxThreads
public int getMaxThreads()
Returns the configured number of maximum threads to use for concurrent propagation when multi-thread evaluation is enabled. Default is zero.- Returns:
-
isDeclarativeAgenda
public boolean isDeclarativeAgenda()
-
setDeclarativeAgendaEnabled
public void setDeclarativeAgendaEnabled(boolean enabled)
Enable declarative agenda- Parameters:
enabled-
-
getWorkDefinitions
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getWorkDefinitions()
-
isAdvancedProcessRuleIntegration
public boolean isAdvancedProcessRuleIntegration()
-
setAdvancedProcessRuleIntegration
public void setAdvancedProcessRuleIntegration(boolean advancedProcessRuleIntegration)
-
addActivationListener
public void addActivationListener(java.lang.String name, ActivationListenerFactory factory)
-
getActivationListenerFactory
public ActivationListenerFactory getActivationListenerFactory(java.lang.String name)
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
-
setClassLoader
public void setClassLoader(java.lang.ClassLoader classLoader)
-
setMBeansEnabled
public void setMBeansEnabled(boolean mbeansEnabled)
Defines if the RuleBase should expose management and monitoring MBeans- Parameters:
mbeansEnabled- true for multi-thread or false for single-thread. Default is false.
-
isMBeansEnabled
public boolean isMBeansEnabled()
Returns true if the management and monitoring through MBeans is active- Returns:
-
setMutabilityEnabled
public void setMutabilityEnabled(boolean mutabilityEnabled)
-
isMutabilityEnabled
public boolean isMutabilityEnabled()
-
getOption
public <T extends org.kie.api.conf.SingleValueKieBaseOption> T getOption(java.lang.Class<T> option)
- Specified by:
getOptionin interfaceorg.kie.api.conf.KieBaseOptionsConfiguration
-
setOption
public <T extends org.kie.api.conf.KieBaseOption> void setOption(T option)
- Specified by:
setOptionin interfaceorg.kie.api.conf.KieBaseOptionsConfiguration
-
getOption
public <T extends org.kie.api.conf.MultiValueKieBaseOption> T getOption(java.lang.Class<T> option, java.lang.String key)- Specified by:
getOptionin interfaceorg.kie.api.conf.KieBaseOptionsConfiguration
-
getChainedProperties
public org.kie.internal.utils.ChainedProperties getChainedProperties()
-
-