users@glassfish.java.net

Re: Can hk2:run be used to run anything meaningful?

From: <glassfish_at_javadesktop.org>
Date: Fri, 16 Jan 2009 15:27:18 PST

Thanks a lot for the clarification, Sahoo. Yes, I've read in your blog about HK2's migration to using OSGi modules; I was just trying to get started with HK2 by using the examples you provided in your blog posts.

In my current project, dynamic module loading and version-specific dependency support are a must, while dependency injection is just a "nice to have". This is fortunate, because for now I can proceed working directly with Felix -- at least until you guys finish the implementation and have a bit of time for creating a user guide and tutorial(s). Then I'd be probably glad to transition to HK2, in order to benefit from your DI implementation -- which to me looks more attractive than Felix iPOJO.

Regarding the hk2:run goal, I too view doing everything in start() as a bit counter-intuitive, and I guess this is happening for historic reasons (with OSGi's start() replacing the run() of the former module system). Perhaps hk2:run should be replaced now with hk2:start and hk2:stop -- allowing start() to launch threads that would do the real job, while the thread that executed start() would wait for a stop command (say, by listening on a port written for the benefit of hk2:stop into a temporary file with a standard name in the current directory -- or any similar mechanism).

Thanks again!
Andrei
[Message sent by forum member 'andreijuan' (andreijuan)]

http://forums.java.net/jive/thread.jspa?messageID=326580