All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kie.internal.conf.ParallelExecutionOption Maven / Gradle / Ivy

Go to download

The Drools and jBPM internal API which is NOT backwards compatible between releases.

There is a newer version: 9.44.0.Final
Show newest version
package org.kie.internal.conf;

import org.kie.api.conf.OptionKey;
import org.kie.api.conf.SingleValueRuleBaseOption;

/**
 * Determines is the engine should evaluate rules and execute their consequences sequentially or in parallel.
 *
 * drools.parallelExecution = <sequential|parallel_evaluation|fully_parallel>
 *
 * DEFAULT = SEQUENTIAL
 */
public enum ParallelExecutionOption implements SingleValueRuleBaseOption {

    SEQUENTIAL, PARALLEL_EVALUATION, FULLY_PARALLEL;

    public static final String PROPERTY_NAME = "drools.parallelExecution";

    public static OptionKey KEY = new OptionKey<>(TYPE, PROPERTY_NAME);

    @Override
    public String getPropertyName() {
        return PROPERTY_NAME;
    }

    public static ParallelExecutionOption determineParallelExecution(final String value) {
        if ("sequential".equalsIgnoreCase(value)) {
            return SEQUENTIAL;
        }
        if ("parallel_evaluation".equalsIgnoreCase(value)) {
            return PARALLEL_EVALUATION;
        }
        if ("fully_parallel".equalsIgnoreCase(value)) {
            return FULLY_PARALLEL;
        }
        throw new IllegalArgumentException("Illegal enum value '" + value + "' for ParallelExecution");
    }

    public boolean isParallel() {
        return this != SEQUENTIAL;
    }

    public String toExternalForm() {
        return this.toString().toLowerCase();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy