On Tue, Jul 20, 2010 at 17:42, Jean-Philippe Clement <[email protected]> wrote: > > > So the null value would mean "no service to register on startup".
Exactly. > Is it an expected (spec compliant) behavior or a "bug"? It's explicitly stated in section 121.7.12 of the Enterprise spec. > > PS: How to avoid null other than adding "if (ref!=null)" in the code? I guess that's the way to go ;-) > Quoting Guillaume Nodet <[email protected]>: > >> I think when a reference (list or not) is created, the listeners have >> to be called. So if there is a matching service in the osgi registry, >> the listener bind method will be called (once for an unary reference >> or once for each object in the list), but if there's no matching >> service, the unbind method will be called. >> This is to make sure your listener is updated wrt to the current state >> when starting. >> >> On Tue, Jul 20, 2010 at 16:08, Jean-Philippe Clement >> <[email protected]> wrote: >>> >>> Hello, I'm using Karaf 1.6.0. A blueprint bundle declares something like: >>> <reference-list interface="..." availability="optional"> >>> <reference-listener ref="SomeRef" bind-method="addStuff" >>> unbind-method="removeStuff" /> >>> </reference-list> >>> >>> When starting the bundle, SomeRef.removeStuff() is called with a null >>> reference. >>> >>> I use reference lists without problems, but this time the unbind method >>> is >>> called with a null reference when the bundle is started. >>> >>> Can anybody tell me why do I get a null reference and what is the meaning >>> of >>> this null? >>> >>> Thanks. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >> >> >> >> -- >> Cheers, >> Guillaume Nodet >> ------------------------ >> Blog: http://gnodet.blogspot.com/ >> ------------------------ >> Open Source SOA >> http://fusesource.com >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > -- Cheers, Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/ ------------------------ Open Source SOA http://fusesource.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

