AFAIK, all service instances are singletons and shared across threads of
the VM unless you declare them perthread as you do with your UserService.

Having multiple independent instances of that service is your actual
problem, as you would have to declare them in source using modifiers,
which is not only tricky but also requires you to provide different
identifiers (names) for each implementation that implements the same
interface and responds to a different action.

And, yes, you should go with the stateless approach and pass along the
action with each method your service implements.

Regards

Carsten


> My bad, I meant modifier. I was setting the modifier with a set method
> then
> accessing the data within the modifer from other methods. If I understand
> trsvax correctly, do not set the modifer, but rather pass the data in
> through my methods. I am setting all services to final and only using
> perthread for my UserService.
>
> I'm assuming this is the correct way to do things, but please verify.
> Thanks
> guys.
>
> public class MyServiceImpl implements MyService {
>
>    private final RoleService roleService;
>
>    public MyServiceImpl(RoleService roleService) {
>        this.roleService = roleService;
>    }
>
>    //I'm not initializing the service with action, but rather passing it
> into the methods.
>    public void someMethod(final Action action) {
>       //does something
>    }
>
>    public void someMethodTwo(final Action action) {
>       //does something
>    }
> }
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Sevice-State-Stateless-tp5716278p5716281.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to