Jess Information

Jess Home
Jess 7 Features
Download Now!
Online Demo

Mailing List
Jess Wiki

More information Related Web Sites
User Contributions
JSR94 Info
Developer's Log
About This Site

JESS ®, the Rule Engine for the JavaTM Platform

Jess Wiki: Jess Run Until Halt

		<EMAIL>kahuna moore a t closedsource*com</EMAIL>
	<NAME>Jess Run Until Halt</NAME>
	<INTENT>Restrict all rule firing to a singleton thread</INTENT>
	<MOTIVATION>Simplify multithreaded integration with Jess</MOTIVATION>
	<APPLICABILITY>Multithreaded applications. On-going rule firing across thread
		contexts. Separation of concerns between Java applications and
	<PARTICIPANTS>Jess Rule Firing Thread, Requesting Threads, Rete Instance, Jess Rules
		and Working Memory, JavaBeans.</PARTICIPANTS>
	<COLLABORATIONS>Jess Rule Firing Thread is started, obtains a Rete instance
		(previously loaded with Rules and Facts) to be shared amoung a set of Requesting
		Threads, and calls Rete#runUntilHalt(). Rules firing and Working Memory
		Requesting Threads needing services from the rules loaded into a shared Rete
		Instance create JavaBeans and definstance them into the Rete Instance as needed to
		trigger Rules firing and Fact creation. Results of the Jess Rules and Facts
		computation, if any, are obtained from the Jess Instance and then consumed by the
		Requesting Threads. The Jess Rules and Facts interact on the Jess Rule Firing Thread
		to implement the computation needed by the Requesting Threads. Coordination for
		one-way computations, ie. no return value(s) or computation status is provided to
		the Requesting Threads, which simply return without waiting for completion.
		Coordination of two-way computations from a sequence(s) of Rule firings can be
		handled according to the JessFutureResultPattern. Thread Independent Rules
		firing is done on a per thread basis with no shared elements or special coordination of
		results. This sub-pattern is used simply to reduce the overhead of Jess Instances in
		the presence of large numbers of threads. Thread Dependent Rules firing requires the
		identification of each threads request state, identification of shared state
		between specified sets of threads, and identification of each thread's computation
		result, including indication that the computation itself is complete or has failed.
		To be continued... Container Thread calls Rete#halt() or the Jess Rule Firing
		threads executes Jess Code that calls (halt).
	<CONSEQUENCES>Trade-offs, issues, general results.</CONSEQUENCES>
	<IMPLEMENTATION>Pitfalls, hints, techniques, and other tips.</IMPLEMENTATION>
	<SAMPLE-CODE>Code to illustrate the pattern.</SAMPLE-CODE>
	<KNOWN-USES>URLs to real-world implementation examples.</KNOWN-USES>
	<RELATED-PATTERNS>Similar Jess Patterns or ones that work well with this pattern.

Thanks Alan! -JM

Front Page | Sandbox | Recent Changes | Powered by Friki | Last Edited: 08 June 2006