Jess Information

Jess Home
Jess 7 Features
Download Now!
Online Demo

Documentation
FAQ
Manual
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: old/ Jess Run Until Halt.2006-06-08-17.39.30

<JESS-PATTERN>
	<AUTHOR>
		<LAST-NAME>Moore</LAST-NAME>
		<FIRST-NAME>Alan</FIRST-NAME>
		<EMAIL>kahuna moore a t closedsource*com</EMAIL>
	</AUTHOR>
	<NAME>Jess Run Until Halt</NAME>
	<INTENT>Restrict all rule firing to a singleton thread</INTENT>
	<ALTERNATE-NAME>RunUntilHalt</ALTERNATE-NAME>
	<MOTIVATION>Simplify multithreaded integration with Jess</MOTIVATION>
	<APPLICABILITY>Multithreaded applications. On-going rule firing across thread contexts. Separation of concerns between Java applications and Jess</APPLICABILITY>
	<STRUCTURE>http://www.closedsource.com/docs/jess/JessRunUntilHalt.html</STRUCTURE>
	<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).
                </COLLABORATIONS>
	<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.
		<PATTERN-NAME></PATTERN-NAME>
		<PATTERN-NAME></PATTERN-NAME>
	</RELATED-PATTERNS>
</JESS-PATTERN>


Thanks Alan! -JM


Front Page | Sandbox | Recent Changes | Powered by Friki | Last Edited: 29 October 2005