I think Ron Day wrote:
> Sorry Earnest but I'm being dumb.
> 

No, this stuff can be tricky.

> 1) Multiple users(threads) use the same Rete object?

Yep; this is why another poster said to search the archives
(http://www.mail-archive.com/[email protected], a nice resource)
for "multithreading". Jess can handle multiple threads calling
"assert" and "run" (etc) on the same Rete object simultaneously.

Obviously if you've got 100 clients all hitting the Rete object at
once, then you need to replicate the application, or use a pool. As
long as a particular user session always uses the same Rete object,
there's no problem (assuming there's state held between service
calls). 

> 
> 2) Would you kindly expand on "....The only thing to remember is
> that per-session facts should include a slot with a session
> identifier, so logical processes from separate sessions stay separate".
> 

Don't write code like this:

(defrule charge-credit-card
        (credit-card ?number)
        (shopping-cart ?cost)
        =>
        (charge-to-credit-card ?cost ?number))

Instead, write code like this:

(defrule charge-credit-card
        (credit-card (card-number ?number) (session ?session))
        (shopping-cart (total ?cost) (session ?session))
        =>
        (charge-to-credit-card ?cost ?number))

If you've got lots of carts and credit cards in the same application,
you'll need to be able to distinguish between them!


---------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to