[Enterprise Extensions only]
  Next topic

How Rule Implementors are invoked

When a Rule is fired for the first time, the following sequence of events takes place:

  1. an instance of the RuleImplementor class is created using the default constructor,
  2. the init method is called, passing the initialization parameters defined for the Rule, and
  3. the fire method is called to elicit the RuleImplementor's behavior.

It is guaranteed that the init method is called at least once before the fire method is called for the first time, although it may be called more than once. Once the RuleImplementor is instantiated, the Rule caches it so that it doesn't have to be created and initialized again the next time that Rule is fired. On subsequent fires, only the RuleImplementor's fire method is called, not its init method. Thus the RuleImplementor is generally initialized only once but can be fired many times.

In some scenarios, the method fire may be called from multiple processes on the same instance of a RuleImplementor. This could happen if more than one client triggers the same rule at the same time. The implication of this is that the method fire should not change instance attributes of the implementor unless synchronization of the data being changed is performed.

  Next topic