osgi / bugzilla-archive

Archive of OSGi Alliance Specification Bugzilla bugs. The Specification Bugzilla system was decommissioned with the move to GitHub. The issues in this repository are imported from the Specification Bugzilla system for archival purposes.
0 stars 1 forks source link

[ds] clarification of the "happens-before" relationships in the DS spec #2756

Closed bjhargrave closed 8 years ago

bjhargrave commented 8 years ago

Original bug ID: BZ#2888 From: @rotty3000 Reported version: R6

bjhargrave commented 8 years ago

Comment author: @rotty3000

The lack of some deliberately explicit "happens-before" relationships in the wording of the DS spec has led to speculation that it might be possible to implement the spec without "guaranteeing" the ordering of operations on components.

Particularly, the case of static reference binding before the invocation of the activate method, and of the reverse during tear down.

During initialization of a component: setting static reference fields HAPPENS-BEFORE calling static reference bind methods which HAPPENS-BEFORE calling the activate method

During destruction of a component: calling the deactivate method HAPPENS-BEFORE calling static reference unbind methods which HAPPENS-BEFORE setting static reference fields to null

I would like this to be emphasized so that implementers cannot accidentally overlook this.

bjhargrave commented 8 years ago

Comment author: @bjhargrave

(In reply to Raymond Augé from comment BZ#0)

During initialization of a component: setting static reference fields HAPPENS-BEFORE calling static reference bind methods which HAPPENS-BEFORE

References are processed in the order they are specified in the xml. So it is not necessarily the case that fields are set before bind methods are called. See 112.5.7: "When binding services, the references are processed in the order in which they are specified in the component description. That is, target services from the first specified reference are bound before services from the next specified reference."

calling the activate method

During destruction of a component: calling the deactivate method HAPPENS-BEFORE calling static reference unbind methods which HAPPENS-BEFORE setting static reference fields to null

The same is also true for deactivation; references are processed based upon the order in the xml. See 112.5.16: "When unbinding services, the references are processed in the reverse order in which they are specified in the component description. That is, target services from the last specified reference are un- bound before services from the previous specified reference."

I would like this to be emphasized so that implementers cannot accidentally overlook this.

bjhargrave commented 8 years ago

Comment author: @rotty3000

(In reply to BJ Hargrave from comment BZ#1)

(In reply to Raymond Augé from comment BZ#0) References are processed in the order they are specified in the xml. So it is not necessarily the case that fields are set before bind methods are called. See 112.5.7: "When binding services, the references are processed in the order in which they are specified in the component description. That is, target services from the first specified reference are bound before services from the next specified reference."

Got it!

bjhargrave commented 8 years ago

Comment author: @bjhargrave

CPEG call: Peter suggests we add text to the Core spec introduction to make clear that when a numbered list is used in a spec, this means that lower numbered items happens-before higher numbered items. This is to allow us to avoid having to repeat this happens-before description all over the many specs.

bjhargrave commented 8 years ago

Comment author: @bjhargrave

Fixed for R7 by https://osgi.org/gitweb/build.git/commit/132745a36da9c789d357ed7f5e993c45a2e24bb2