You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by David Lindelöf <da...@adhoco.com> on 2007/10/22 11:38:43 UTC

getAllServiceReferences vs getServiceReferences ?

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?

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 david.lindelof@adhoco.com
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: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: getAllServiceReferences vs getServiceReferences ?

Posted by Stuart McCulloch <st...@jayway.net>.
On 22/10/2007, David Lindelöf <da...@adhoco.com> 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 david.lindelof@adhoco.com
> 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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers, Stuart