You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Radu Cotescu <ra...@apache.org> on 2014/08/22 17:17:25 UTC

BindingsValuesProvider services ordering

Hi,

In SLING-3320 [0] we introduced some ordering in the BVPs maps, such that
BVPs are called using the natural ordering of their ServiceReferences,
which is based on the service.ranking value: the higher the service.ranking
is, the later in the call chain will a BVP be called to add its bindings.

Given that in the OSGi world the service.ranking is used to determine which
implementation is returned for a certain service, the rule of thumb being
that the higher the service.ranking is the most likely that implementation
will be provided, should't we actually reverse the sort order of the BVPs?

In theory this might introduce some subtle bugs in clients' code, but no
one complained when we introduced the ordering in the first place.

WDYT?

Cheers,
Radu

[0] - https://issues.apache.org/jira/browse/SLING-3320

Re: BindingsValuesProvider services ordering

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi Radu


2014-08-23 17:43 GMT+02:00 Radu Cotescu <ra...@apache.org>:

> Hi Carsten,
>
> You are right, the BVP with the highest service.ranking is called last. But
> shouldn't it be called first, in order to be consistent with the OSGi way
> of obtaining a reference? To me it's counter-intuitive to set the
> service.ranking value to a negative value if I want my BVP to be called
> before a another BVP with no service.ranking property set explicitly.
>
> In the end I think the answer revolves around the way we think a BVP is
> more powerful: if it's called last in the queue or first.
>
> Right, its more powerful if it runs last, as it can overwrite/change
values provided by earlier BVPs

Carsten


> Regards,
> Radu
>
>
> On Fri, Aug 22, 2014 at 6:44 PM, Carsten Ziegeler <cz...@apache.org>
> wrote:
>
> > Hi Radu,
> >
> > I think the current order is giving the service with the highest ordering
> > the final call. If two providers provide a value for the same key, the
> one
> > with the highest wins as it is called last. So I think this matches the
> > other usages of service ranking.
> >
> > Regards
> > Carsten
> >
> >
> > 2014-08-22 17:17 GMT+02:00 Radu Cotescu <ra...@apache.org>:
> >
> > > Hi,
> > >
> > > In SLING-3320 [0] we introduced some ordering in the BVPs maps, such
> that
> > > BVPs are called using the natural ordering of their ServiceReferences,
> > > which is based on the service.ranking value: the higher the
> > service.ranking
> > > is, the later in the call chain will a BVP be called to add its
> bindings.
> > >
> > > Given that in the OSGi world the service.ranking is used to determine
> > which
> > > implementation is returned for a certain service, the rule of thumb
> being
> > > that the higher the service.ranking is the most likely that
> > implementation
> > > will be provided, should't we actually reverse the sort order of the
> > BVPs?
> > >
> > > In theory this might introduce some subtle bugs in clients' code, but
> no
> > > one complained when we introduced the ordering in the first place.
> > >
> > > WDYT?
> > >
> > > Cheers,
> > > Radu
> > >
> > > [0] - https://issues.apache.org/jira/browse/SLING-3320
> > >
> >
> >
> >
> > --
> > Carsten Ziegeler
> > Adobe Research Switzerland
> > cziegeler@apache.org
> >
>



-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: BindingsValuesProvider services ordering

Posted by Radu Cotescu <ra...@apache.org>.
Hi Carsten,

You are right, the BVP with the highest service.ranking is called last. But
shouldn't it be called first, in order to be consistent with the OSGi way
of obtaining a reference? To me it's counter-intuitive to set the
service.ranking value to a negative value if I want my BVP to be called
before a another BVP with no service.ranking property set explicitly.

In the end I think the answer revolves around the way we think a BVP is
more powerful: if it's called last in the queue or first.

Regards,
Radu


On Fri, Aug 22, 2014 at 6:44 PM, Carsten Ziegeler <cz...@apache.org>
wrote:

> Hi Radu,
>
> I think the current order is giving the service with the highest ordering
> the final call. If two providers provide a value for the same key, the one
> with the highest wins as it is called last. So I think this matches the
> other usages of service ranking.
>
> Regards
> Carsten
>
>
> 2014-08-22 17:17 GMT+02:00 Radu Cotescu <ra...@apache.org>:
>
> > Hi,
> >
> > In SLING-3320 [0] we introduced some ordering in the BVPs maps, such that
> > BVPs are called using the natural ordering of their ServiceReferences,
> > which is based on the service.ranking value: the higher the
> service.ranking
> > is, the later in the call chain will a BVP be called to add its bindings.
> >
> > Given that in the OSGi world the service.ranking is used to determine
> which
> > implementation is returned for a certain service, the rule of thumb being
> > that the higher the service.ranking is the most likely that
> implementation
> > will be provided, should't we actually reverse the sort order of the
> BVPs?
> >
> > In theory this might introduce some subtle bugs in clients' code, but no
> > one complained when we introduced the ordering in the first place.
> >
> > WDYT?
> >
> > Cheers,
> > Radu
> >
> > [0] - https://issues.apache.org/jira/browse/SLING-3320
> >
>
>
>
> --
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org
>

Re: BindingsValuesProvider services ordering

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi Radu,

I think the current order is giving the service with the highest ordering
the final call. If two providers provide a value for the same key, the one
with the highest wins as it is called last. So I think this matches the
other usages of service ranking.

Regards
Carsten


2014-08-22 17:17 GMT+02:00 Radu Cotescu <ra...@apache.org>:

> Hi,
>
> In SLING-3320 [0] we introduced some ordering in the BVPs maps, such that
> BVPs are called using the natural ordering of their ServiceReferences,
> which is based on the service.ranking value: the higher the service.ranking
> is, the later in the call chain will a BVP be called to add its bindings.
>
> Given that in the OSGi world the service.ranking is used to determine which
> implementation is returned for a certain service, the rule of thumb being
> that the higher the service.ranking is the most likely that implementation
> will be provided, should't we actually reverse the sort order of the BVPs?
>
> In theory this might introduce some subtle bugs in clients' code, but no
> one complained when we introduced the ordering in the first place.
>
> WDYT?
>
> Cheers,
> Radu
>
> [0] - https://issues.apache.org/jira/browse/SLING-3320
>



-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org