You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by AFrieze <AF...@simmgene.com> on 2006/12/14 21:59:28 UTC

Action Synchronization, module-cache=true

Hi.

I am working on a Turbine project someone else set up.  All their action 
methods are synchronized.

Example)
    public final synchronized void doPerform( RunData data,Context 
context ) throws Exception {
      ...
   }

Inside our TurbineResources.properties file,  the line

   module-cache=true

can be found.   I assume this means that each class instance is cached 
and will be reused.  When this variable is set to true, only one request 
to a given method can process at a time due to the synchronization, when 
it is set to false, more than one request will process, but I assume it 
takes time to reload the module.   Most of our actions perform database 
queries which may take some time.  Under heavy load, this can be an issue. 

I want to remove synchronized from all our action methods.  Will this 
cause problems?  I have to assume that the original developers made 
these methods synchronized for a reason, but am unable to determine it. 
A web server which can process only one request to an action does not 
seem correct.  All our session data is synchronized.

Thank You
AFrieze



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


Re: Action Synchronization, module-cache=true

Posted by AFrieze <AF...@simmgene.com>.
Thomas Vandahl wrote:
> AFrieze wrote:
>   
>> I am working on a Turbine project someone else set up.  All their action
>> methods are synchronized.
>>     
> [...]
>   
>> I want to remove synchronized from all our action methods.  Will this
>> cause problems?  I have to assume that the original developers made
>> these methods synchronized for a reason, but am unable to determine it.
>> A web server which can process only one request to an action does not
>> seem correct.  All our session data is synchronized.
>>     
>
> Well, this depends on the way the actions are written. You should not
> use class variables in these classes if you want to have
> module.cache=true. With module.cache=false, everything should be working
> fine without synchronization. I guess you need to check all actions for
> private fields and common data objects. I never use synchronization in
> actions if I can help it.
>
> Bye, Thomas.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>
>   
Thomas.

  I have unsynchronized a large number of action methods and will be 
launching today.  All the session data has been synchronized and I have 
synchronized on individual objects where it is warranted. There are no 
class variables within the action classes and everything should be 
fine.  I just do not understand why the original developers synchronized 
everything to begin with.

Thanks
  AFrieze

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


Re: Action Synchronization, module-cache=true

Posted by Thomas Vandahl <tv...@apache.org>.
AFrieze wrote:
> I am working on a Turbine project someone else set up.  All their action
> methods are synchronized.
[...]
> I want to remove synchronized from all our action methods.  Will this
> cause problems?  I have to assume that the original developers made
> these methods synchronized for a reason, but am unable to determine it.
> A web server which can process only one request to an action does not
> seem correct.  All our session data is synchronized.

Well, this depends on the way the actions are written. You should not
use class variables in these classes if you want to have
module.cache=true. With module.cache=false, everything should be working
fine without synchronization. I guess you need to check all actions for
private fields and common data objects. I never use synchronization in
actions if I can help it.

Bye, Thomas.


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