karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xtra Coder <xtraco...@gmail.com>
Subject Re: @Reference(service = MyApi.class) is not re-populated
Date Fri, 08 Mar 2019 00:31:03 GMT
Thanks very much, I was able to make first step with your hints.

Second step is - How to get notification about change in the set of
provisioned references?

I've crafted test project from Karaf examples here ...
https://github.com/xtracoder/karaf-experimental/blob/master/examples/karaf-scr-example/karaf-scr-example-client/src/main/java/org/apache/karaf/examples/scr/client/ConsoleClient.java#L38

When i stop/start one of the MyApi-implementation bundles, 'implementations'
field do being updated as traced by background thread, but none of the
`implementationsUpdated()` or `modified()` gets called.

Can I somehow get that notification from the OSGI framework about change of
the 'implementations' field?

Sample code:
- - - - - -

    @Reference(service        = MyApi.class
               , cardinality  = ReferenceCardinality.MULTIPLE
               , policy       = ReferencePolicy.DYNAMIC
               , policyOption = GREEDY
               , fieldOption  = FieldOption.UPDATE
               , updated      = "implementationsModified"
               )
    private List<MyApi> implementations;


    public void implementationsUpdated() throws Exception {
       
System.out.println("--------------------------------------------------------------------
updat = " + instanceId + ": " + implementations);
        running = false;
    }

    @Modified
    public void modified() throws Exception {
       
System.out.println("--------------------------------------------------------------------
modif = " + instanceId + ": " + implementations);
        running = false;
    }






--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Mime
View raw message