When your service has state (injected services doesn't count) which is per
thread.
On Thu, 14 Nov 2013 18:35:47 -0200, George Christman
<gchrist...@cardaddy.com> wrote:
Hello I'm looking to build a service where I would be Injecting a
hibernate session as well as synchronizing a few methods for multi
threading. I'm
confused as for when I should be using the PERTHREAD scope.
If your service has state and it (the state) should be the same for more
than one thread (in your case, the lock), it cannot be per thread,
otherwise you'd had one lock per thread, which would be useless in a
multithreaded scenario.
If I were to use the second example, would the getLogicMethod be
synchronized across threads while being called from another service?
Yes. That's how Java works.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org