commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jiaqi <cyclopsgr...@gmail.com>
Subject Re: [jelly] Stateless/Stateful Tag?
Date Wed, 03 Nov 2004 19:22:48 GMT
Hi Hans,

"* Clear the variables for a tag as soon as the tag's finished
running." Does this mean I need to write
"context.getVariables().clear()" in EVERY doTag()? If it does, it
would be a nightmare for me since there're hundreds of tags.

clearAllVariables sounds good but I'm not sure how to do it. In
to-level, I have a Script, one root JellyContext. How can I clear all
variables in a hierarchy of JellyContext objects?

Do you mean I should write a SmartJellyContext which knows it's children?


Thanks a lot
Jiaqi


On Tue, 02 Nov 2004 23:40:51 -0500, Hans Gilde
<hgilde-commons@earthlink.net> wrote:
> This has been discussed recently. Some are in favor of passing the context
> down through the execution chain, some are in favor of separating the
> variable storage from the rest of the context.
> 
> We may be able to solve your problem without deciding the issue now.
> 
> JellyContext is designed to be sub classed by the end user, to provide
> custom memory management. We can't clear out the actual context objects but
> maybe we can do the next best thing by clearing out the HashMap of
> variables.
> 
> You could:
> 
> * Clear the variables for a tag as soon as the tag's finished running.
> * Provide a method on the top-level context, "clearAllVariables", to let you
> programmatically clear the top-level and all child context variables between
> runs.
> 
> Would either of these work for you? If so, your problem can be solved pretty
> quickly with only a custom JellyContext.
> 
> Hans
> 
> 
> 
> -----Original Message-----
> From: Jiaqi [mailto:cyclopsgroup@gmail.com]
> Sent: Tuesday, November 02, 2004 12:56 PM
> To: Jakarta Commons Users List
> Subject: Re: [jelly] Stateless/Stateful Tag?
> 
> So what is the best practice for developer to frequently execute
> predefined jelly script?
> 
> In my project, process is defined in xml file, which will not be
> changed logically, which could be very complicated. Logically volatile
> stuff is variables (like current user name and form data). It's easier
> for me to model process definition with tag/scripts and put variables
> into JellyContext. Otherwise, I can not figure out any solution else.
> 
> What is your suggestions? Thanks
> 
> On Tue, 2 Nov 2004 09:37:25 +0100, Paul Libbrecht <paul@activemath.org>
> wrote:
> > Mmmh,
> >
> > I would rather view the contrary: tag and tagscript objects are
> > entirely volatile where the context is something that stores exactly
> > how much you want (that is, not more than needed).
> > So I'd rather rely on the jelly-context to add states of the tag...
> >
> > paul
> >
> > Le 1 nov. 04, à 20:41, Jiaqi Guo a écrit :
> >
> >
> >
> > > Hi everyone,
> > >
> > > I want to reuse jelly Script object since in my current project,
> > > Script will run frequently with different given JellyContext created
> > > at runtime and I don't want to create Script and Tag objects time and
> > > time again.
> > >
> > > My concern is, in TagScript, Tag object is cached in ThreadLocal and
> > > runtime JellyContext object is sitting in Tag object. So runtime
> > > context is saved until next time the Script runs. To my understanding,
> > > JellyContext should not be saved because it's transient. Putting it
> > > into Tag object makes developer easy, and makes Tag object stateful.
> > >
> > > Is there any thing I can do to clean Tag objects after the doTag
> > > method is called without explicitely add setContext(null) in each
> > > doTag() method, or prevent Tag from absorbing JellyContext into
> > > itself? Any suggestions?
> > >
> > >
> > >
> > > Thanks
> > > Jiaqi
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
> 
> --
> Regards
> JIaqi
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


-- 
Regards
JIaqi

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message