On Nov 20, 11:24 am, William Pietri <will...@scissor.com> wrote: > Do you have an opinion on Jesse's proposed solution, the one involving > Guava? I don't yet know enough about Guice's internals to know whether > your discovery means that his approach would also founder on the same > rocks you uncovered.
I'm just trying to get my head around it now. I guess the idea is that you would move all initialization activity into a start() method and use the lifecycle stuff to call all the start() methods in parallel. I guess it's a start -- no pun intended -- but in its current state, I don't see how you would deal with interdependencies between Startables, and it seemed like that was the main issue you were hoping Guice could quasi-magically address: Service A needs both Service B and Service C started before it can itself start. What you'd like to be able to say is something like this: class ServiceA implements Service { private final ServiceB b; private final ServiceC c; @Inject ServiceA(ServiceB b, ServiceC c) { this.b = b; this.c = c; } public void start() throws InterruptedException { waitForStart(b, c); // where waitForStart is a blocking utility method provided the lifecycle machinery expensiveInitialization(b, c); } ... } Maybe something like this is already there and I just missed it? During JSR 330 discussions, when I was nattering on about documenting concurrency properties of injection, Bob Lee led me to believe that a parallel injector would be really, really hard to do. So I don't think we'll ever be able to do something like this: class ServiceA implements Service { @Inject ServiceA(Provider<ServiceB> bp, Provider<ServiceC> c) { expensiveInitialization(bp.get(), cp.get()); } ... } and have the ServiceB and ServiceC constructions happen in parallel. --tim -- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to google-gu...@googlegroups.com. To unsubscribe from this group, send email to google-guice+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.