users@hk2.java.net

HK2 Events moving and changing

From: john wells <john.wells_at_oracle.com>
Date: Sat, 18 Apr 2015 07:35:31 -0400

The default implementation of HK2 events is moving from the hk2-api
module to the hk2-extras module. This is to reduce the minimal
footprint of HK2 in environments that do not use events.

This means that the API enableTopicDistribution
<https://hk2.java.net/2.4.0-b16/apidocs/org/glassfish/hk2/utilities/ServiceLocatorUtilities.html#enableTopicDistribution%28org.glassfish.hk2.api.ServiceLocator%29>
will be deprecated in the next "b" release of HK2 and removed in the
following "b" release of HK2. The enableTopicDistribution method will
be added to ExtrasUtilities
<https://hk2.java.net/2.4.0-b16/apidocs/org/glassfish/hk2/extras/ExtrasUtilities.html>.

Further, there will be a change to the default implementation of
Topics. Please note this ONLY affects the default implementation, any
custom implementation you have of Topics will remain the same. The
changes is this:

In order to receive topic events your class or factory must have a new
Qualifier put on it (likely named EventReceiver). EventReceiver will
take an optional list of event classes that the class or factory provide
method can receive.

This makes the default implementation much less heavy-weight as it no
longer needs to scan every created class for @SubscribeTo annotations.
Furthermore, it makes the feature somewhat easier to use, as there is no
more requirement that a service be instantiated PRIOR to receiving
events. When an event is fired all subscribers will receive the event
whether or not the service has been previously instantiated.

We hope that this change in the Eventing API does not cause undo change
in your applications.

As always any feedback is welcome!

John Wells
john.wells_at_oracle.comNOSPAM