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

org.drools.runtime.rule.StatefulRuleSession Maven / Gradle / Ivy

There is a newer version: 5.1.1
Show newest version
package org.drools.runtime.rule;

/**
 * An interface for all StatefulRuleSession methods. This interface
 * adds methods available to the StatefulKnowledgeSession beyond what the WorkingMemory provides. 
 * 
 * @see org.drools.runtime.StatefulKnowledgeSession 
 */
public interface StatefulRuleSession {

    /**
     * Fire all Activations on the Agenda.
     * @return
     *     returns the number of rules fired
     */
    int fireAllRules();

    /**
     * Fire Activations on the Agenda up to the given maximum number of activations, before returning
     * the control to the application.
     * In case the application wants to continue firing the rules later, from the point where it stopped,
     * it just needs to call fireAllRules() again.
     * 
     * @param max
     *     the maximum number of rules that should be fired
     * @return
     *     returns the number of rules fired
     */
    int fireAllRules(int max);

    /**
     * Fire all Activations on the Agenda
     * 
     * @param agendaFilter
     *      filters the activations that may fire
     * @return
     *      returns the number of rules fired
     */
    int fireAllRules(AgendaFilter agendaFilter);

    /**
     * Keeps firing activations until a halt is called. If in a given moment,
     * there is no activation to fire, it will wait for an activation to be
     * added to an active agenda group or rule flow group. This blocks the thread
     * until halt is called.
     * 
     * @throws IllegalStateException
     *             if this method is called when running in sequential mode
     */
    public void fireUntilHalt();

    /**
     * Keeps firing activations until a halt is called. If in a given moment,
     * there is no activation to fire, it will wait for an activation to be
     * added to an active agenda group or rule flow group. This blocks the thread
     * until halt is called.
     * 
     * @param agendaFilter
     *            filters the activations that may fire
     * 
     * @throws IllegalStateException
     *             if this method is called when running in sequential mode
     */
    public void fireUntilHalt(final AgendaFilter agendaFilter);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy