eclipse-kura / kura

Eclipse Kura™ is a versatile framework to supercharge your edge devices, streamlining the process of configuring your gateway, connecting sensors, and IoT devices to seamlessly collect, process, and send data to the cloud.
https://eclipse.dev/kura/
Eclipse Public License 2.0
500 stars 309 forks source link

Check DS dynamic reference bind/unbind methods #2561

Closed nicolatimeus closed 4 years ago

nicolatimeus commented 4 years ago

Osgi DS spec [1] section 112.5.12 states that when a service instance bound using dynamic references is replaced with another one, the invocation of bind() method injecting the new service happens before the unbind() invocation for the old service.

We should check existing components that use this kind of references (e.g. wires publisher) to verify if their bind()/unbind() implementations are compliant.

[1] https://osgi.org/specification/osgi.cmpn/7.0.0/service.component.html

spnettec commented 4 years ago

Always before the unbind() invocation for the old service. CloudSubscriber: public void unsetCloudSubscriber(org.eclipse.kura.cloudconnection.subscriber.CloudSubscriber cloudSubscriber) { this.cloudSubscriber.unregisterCloudSubscriberListener(CloudSubscriber.this); if (this.cloudSubscriber == cloudSubscriber) this.cloudSubscriber = null; } CloudPublisher: public void unbindWireHelperService(final WireHelperService wireHelperService) { if (this.wireHelperService == wireHelperService) { this.wireHelperService = null; } }