Just as in any other programming environment, global variables aren't "reentrant." If you're going to have multiple clients simultaneously, then you can't use global variables (unless they hold client-independent data, of course.)
Use facts instead to hold each client's helpTextIndex, or use (store) and (fetch) to hold per-client data using the client ID as the unique name, or... there are plenty of alternatives. I think Rajaram Subramanian wrote: > Hi, > This is related to an earlier question of mine. I have numerous > clients(applets) connecting and passing messages to a servlet. This > servlet receives it, parses it so that Jess can understand it and > passes it to a ServerSocket program(lets call it ExpSys) that has an > instance of Rete. ExpSys receives the fact and asserts or retracts > accordingly and returns a message back so servlet which is then sent back > to client applet(s). To my earlier qn as to how diff clients can share the > same instance of Rete, Ernest had suggested the use of clientId in the > fact (Unordered) so as to differentiate between the clients. My clp file > looks a bit like this... > > ; helpTextIndex will hold the indices of the help msg that i pass back to > ; client. As we see the student making more and more mistakes, we concat > ; the helpTextIndex with the corresponding index. > > (defglobal ?*helpTextIndex* = (new java.lang.String " ")) > > (defrule switch-not-on-action > ;If student is trying to operate without turning on the switch, then > ;tell him so > (biofact (id ?x) (bfact help-requested)) (biofact (id ?x) (bfact > switch-not-on)) > => > (bind ?*helpTextIndex* (call ?*helpTextIndex* concat " 0"))) > > and so on... > > My question is, how will multiple clients not affect and corrupt the value > of helpTextIndex? Also, will this achieve the purpose of differentiating > between multiple clients at all or did i interpret Ernest's suggestion > wrongly? > > Please let me know, > Thank you, > Raj. > > > > -------------------------------------------------------------------- > 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] --------------------------------------------------------------------
