I think chinnaswamy gounder wrote:
> Hi All,
>
> I seek your advice to clear my following doubts:
>
>
> 1. If a Rete object in running continuously ( using
> runUntilHalt() method )on a seperate thread and since
> Jess 6.0a5 is supporting Java 2, can I invoke the
> reset() method from an EJB bean on the running Rete
> object.
I'm sure Ijust answered this question in another message. Qualifying
it with "EJB bean" doesn't change the answer at all.
>
> 2. Reset() on the Rete object is to be done when it
> sleeps i.e. after completing the previous threads job
> ( waiting for next execution ). Before I invoke
> reset() method from an EJB, how to confirm that
> previous EJB thread is finished. Notify()method is for
> general threaded programming; but what about EJB
> threads.
>
This is silly. If every client request is going to call reset(),
then why would you want to run the engine using runUntilHalt() on its
own thread? Just have each client thread call reset() and run() and
then when run() returns, it's done. You'd have to do your own mutual
exclusion by making resetAndRun() a synchronized method someplace.
In general, reset() is an expensive operation, and calling reset
constantly will negate much of the advantage of using the Rete
algorithm in the first place. With a bit of care it would be easy to
design your rules such that multiple sets of client facts could
coexist simultaneously and the reset() calls would be unnecessary.
> Moreover, if we assert with definstance with dynamic
> option, there may be situation that for a particular
> thread the rete engine ( running until halt ) may have
> to be busy for the whole session of that thread.
*** Not sure what you're asking here.
>
> 3. Still it is not clear to me that from a one rete
> object running, getting facts asserted from many
> threads, how the results are communicated back to the
> corresponding threads( especially with EJBs). and,
>
However you want to. Jess isn't different or magic in any way. Buy
Doug Lea's book on Concurrent Programming in Java, read it, and pick a
strategy. One simple way I can describe in a sentence or three: when a
fact to initiate a session is asserted, one of its slots should point
to the client object. That client object should have a method
reportResults. When a rule wants to report results, it calls
reportResults on that object. If multiple threads are involved, then
reportResults probably needs to be synchronized and call notify() to
wake up another thread that was waiting for a result.
> 4. By using ( defclass ) and ( definstance )
> functions, we are able to put the Java Beans
> Properties in the knowlegde base. While running the
> rete object, these properties may get be changed. Is
> there a need to transfer these changed properties back
> to Java code by using store and fetch methods or they
> get changed automatically.
Everything gets updated automatically, of course, if they are dynamic
definstances and the beans properly implement PropertyChangeEvents.
>
> Advance Thanks for your suggestions
>
> With regards,
> Chinnaswamy.
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices.
> http://auctions.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list (use your own address!) List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------