Hi folks,

     I don't have a very clear question, though I think a recent
question on the list relates to mine (David White asked about the
overhead of initializing an Interp object and whether it made sense to
reuse them; Moses Dejong replied) and covers some of the issues.  

     Part of what I'm running into is my own limited knowledge of TCL
and JACL; I'm not sure what makes sense in how the scripts would be
written.  Hopefully I can explain the general situation and get
feedback from people:

     Essentially I want to use JACL scripts inside a java program.
The program (actually a set of interacting programs, some of them java
servlets) takes various flavors of requests from users, for each
request gets the same set of records for that user, then applies a set
of "rules" to that set of records, finally arriving at a conclusion
and sending the results back.  

     Actually, the user records are really a vector of record objects,
each of which may contain a vector of detail objects, each of which
may contain a vector of comment objects.  Some of the rules have to
check the comments, others have to check certain values in the
details, others just have to check the records.  

     For example, one basic rule will be "sort out any record where
the type is not in this list of types that we know about."  Another
basic rule will be, sort the records according to the value in a
certain column in the details.  Yet another will be, remove any
records that have a certain string in any of their comments.  At the
last, depending on the type of request, will be a rule that converts
the selected record or set of records into some kind of meaningful
real-world content (select an image name, insert a defined piece of
text, direct the user to a specific web page).

     I want to use JACL scripts to write the rules that will be used
to sort and sift the various user records and finally convert them to
some applicable form of data.  I thought it would make a lot of sense
to use TCL instead of inventing my own half-assed rules language.
What I'm trying to figure out is whether I need to use multiple TCL
interp objects, and if so, whether I need to use one per rule object,
or clone the rule object (and thus have a fresh interp object) for
each request, etc.  From a TCL standpoint, how would you design this?

     My bugaboo, of course, is multithreading.  This system needs to
respond to multiple, asynchronous requests, some of them probably
involving the same user records.  I suspect the rules could be pretty
much stateless, which would mean that other than local variables in
the scripts, there would be nothing to worry about synchronization.  I
suspect (though I'm still reading through the JACL docs to figure this
out) that I could actually have one interp object, and within that
have each rule defined as a routine.  Is this true?  

     If so, could the Interp object be used in a multi-threaded
fasion?  I.e. each new request being handed off to a rule object, or
would it be single-threaded?  If TCL/JACL doesn't support
multithreading intrinsically, then I'd have to instantiate a new
Interp object for each request (or perhaps keep a pool of them
to avoid the instantiation overhead).

Steven J. Owens
[EMAIL PROTECTED]
[EMAIL PROTECTED]

----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
A list archive is at: http://www.findmail.com/listsaver/tcldallas/

Reply via email to