Yes, according to the specification a framework is free to return distinct ServiceReference objects which reference the same ServiceRegistration object. So in theory you could get a different SerivceReference object back from each call to BundleContext#getServieReference(s). But in a dynamic framework where ServiceRegistrations can come and go this is always true. Clients should never depend on using == to determine equality of ServiceReference objects. You should always use the equals() method.
Tom |------------> | From: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |Ikuo Yamasaki <[email protected]> | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | To: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |[email protected] | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Date: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |06/05/2009 06:13 AM | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Subject: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |[osgi-dev] Multiple ServiceReference for one ServiceRegistration ? | >--------------------------------------------------------------------------------------------------------------------------------------------------| Hi OSGi Experts, I have a question in the core spec. ------------------ 6.1.23 public interface ServiceReference extends Comparable page 186 in R4.1 Core Spec Every service registered in the Framework has a unique ServiceRegistration object and may have multiple, distinct ServiceReference objects referring to it. ------------------ What kind of cases are multiple ServiceReference objects are needed for a unique ServiceRegistration? (only one object is needed, IMO). # Does it mean "there might be a framework impl, which returns distinct # ServiceReference objects for every time when # BundleContext#getServiceReference(s) is called, # although it is not required in theory" ? Best regards, --------------------- NTT Cyber Solutions Laboratories Ikuo YAMASAKI E-mail: [email protected] TEL +81-46-859-8537 FAX +81-46-855-1282 _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
<<inline: graycol.gif>>
<<inline: ecblank.gif>>
_______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
