turbine-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vandahl ...@apache.org>
Subject Re: Synchronized Velocity Actions
Date Mon, 27 Nov 2006 20:06:56 GMT
Sheldon Ross wrote:
> Let's see, there exists session persistent objects that we need to
> protect, ie preventing a user from performing an action that will change
> the contents of that object while another of his own method calls is
> using that object. But these objects are only session specific, another
> user has his own session object.

Yeah, right. In this case you should synchronize the access of these
very objects and not the action as a whole.

Please note that if you have module.cache=true in TR.properties, the
same instance of your action may run several times in parallel. So your
actions need to be thread safe anyway.

> Therefore from what I understand, each user should be able to run there
> own methods at the same time as they do not reference any of the same
> objects. Unfortunately this is not happening. I was curious as to if
> anyone knew why this was. The only thing I can think of, is that somehow
> there is something in the RunData object, or the Velocity Context that
> is the same between both sessions. This would prevent the methods from
> being able to run at the same time.

AFAIK, the synchronization depends on the instance of an object. RunData
 and Context objects are not identical (=not the same instance) in
different calls even if they contain the same information. Note that at
least RunData objects are pooled inside Turbine, so you might come
across the same instance every now and then. But never at the same time.

Bye, Thomas

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

View raw message