This looks like an issue ... I think EagerLoad is not compatible with
non-singleton scopes.
What does it mean to eager load a service that is, in fact, used in
multiple threads?
Ah, here's the issue; when you bind a class, not an interface, as a
service, it automatically uses singleton scope. Only proxiable
services can have non-singleton scope, and that means an interface and
an implementation. Tapestry should detect this and throw an
exception.
On Thu, Jul 24, 2008 at 11:01 AM, Franz Amador <[EMAIL PROTECTED]> wrote:
>
> I have an EagerLoad service that uses a PerThread service. I expected the
> EagerLoad service to hold a reference to a proxy to the PerThread service so
> that the actual instance of the PerThread service that is used depends upon
> the thread calling the EagerLoad service. Instead, the EagerLoad service is
> getting a reference to an actual instance of the PerThread service, not to a
> proxy, so the same instance of the PerThread service is getting used by all
> threads that call the EagerLoad service. This surely can't be right.
> Here's a very simplified example:
>
> public class AppModule {
> public static void bind(ServiceBinder binder) {
> binder.bind(EagerLoadService.class);
> binder.bind(PerThreadService.class);
> }
> }
>
> @EagerLoad
> public class EagerLoadService {
> public EagerLoadService(PerThreadService perThreadService) {
> // prints "class PerThreadService", not a proxy class!
> System.out.println(perThreadService.getClass());
> }
> }
>
> @Scope(PERTHREAD_SCOPE)
> public class PerThreadService {
> }
>
> Is this a bug? Am I confused about how this should work? All help
> appreciated.
>
> --
> View this message in context:
> http://www.nabble.com/EagerLoad-service-doesn%27t-use-PerThread-service-correctly-tp18637337p18637337.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]