Follow Us on Twitter

Devoxx talk about HK2 – Jerome Dochez

by Jos Nieuwenhuis on November 18, 2010 · 1 comment

HK2 is the library used in Glassfish for doing the lookup and instantiation of modules (and all the depending modules). It wraps the OSGi implementation, which can be Felix or Equinox. The OSGi is wrapped because OSGi itself is too complex. The HK2 has a service based architecture. In the modules annotations @Service, @Contract, and @Inject are used. Services are components with a scope. No class-loader is actually created until a service is actually requested. HK2 is open source:

HK2 is the base of Glassfish and will also be part of WebLogic Server. Glassfish and WebLogic AS have different purposes. According to the speaker the two will co-exist. Glassfish is an application server with a very fast startup-time and loads modules lazily. It is very useful  for developers, because it facilitates changes in source code. You can keep Glassfish running while changing the source code. WebLogic Server is different, because it wants to load many modules at startup. It is more suitable for deploying components in a controlled manner. The lifecycle (runtime states) in WebLogic Server is more sophisticated than the one used by Glassfish.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

{ 1 comment… read it below or add one }

whocares November 21, 2010 at 12:51 pm

It’s a reinvention of what’s there in other dependency injection framework.


Leave a Comment


Previous post:

Next post:

About Whitehorses
Company profile

Whitehorses website

Home page

Follow us
Blog post RSS
Comment RSS