dev@glassfish.java.net

Re: help listening for config changes

From: Amy Roh <amy.roh_at_oracle.com>
Date: Thu, 05 Aug 2010 13:52:13 -0700

Bobby Bissett wrote:
> Howdy,
>
> I have a class that implements import
> org.jvnet.hk2.config.ConfigListener, but I'm not seeing the
> changed(PropertyChangeEvent[] events) method ever called when I do it
> see it called in other classes. Is there some other requirement
> besides implementing that interface that this class needs to meet?
> Does it need to be annotated with org.jvnet.hk2.annotations.Service
> for instance? I don't think I want this class to be a service.

Did you add the ConfigListener to the config object you want to listen to?

For example, if you want to listen to network-listeners changes -

NetworkConfig networkConfig = config.getNetworkConfig();
configListener = new DynamicConfigListener();
       
ObservableBean bean = (ObservableBean)
ConfigSupport.getImpl(networkConfig.getNetworkListeners());
*bean.addListener(configListener);*

Amy

>
> Thanks,
> Bobby
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>