On 22/10/2007, David Lindelöf <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> BundleContext.getAllServiceReferences(...) and getServiceReferences(...)
> have the same signature and almost same Javadoc. I do not understand
> their difference. Could somene please help me?


getServiceReferences(...) returns service references guaranteed to be
classloader compatible with your bundle
ie. you should not get a ClassCastException when you cast the service
instance to the appropriate class/interface.
( basically filters the set with isAssignableTo... )

getAllServiceReferences(...) returns all service references matching the
request, regardless of whether they are
classloader compatible, so you may get ClassCastExceptions if you tried to
actually use the service instance

see the method javadoc (http://www2.osgi.org/javadoc/r4) for the algorithms
used to create each set of references

Kind regards,
> --
> --------------------------------------------------
> David Lindelöf
> Product Developer
> Adhoco AG
> Technopark
> Jagerstrasse 2
> 8406 Winterthur
> tel +41-52-264.5070
> mob +41-79-415.6641
> fax +41-52-264.5099
> e-mail [EMAIL PROTECTED]
> url http://www.adhoco.com
> weblog http://www.visnet.ch/smartbuildings/
> --------------------------------------------------
>
> That money talks,
> I'll not deny,
> I heard it once,
> It said "Good-bye.
>                 -- Richard Armour
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Cheers, Stuart

Reply via email to