Skip to main content



      Home
Home » Eclipse Projects » Virgo » listener (bind-method and unbind-method) bundle behavior when listened service leaves
listener (bind-method and unbind-method) bundle behavior when listened service leaves [message #769216] Wed, 21 December 2011 10:29 Go to next message
Eclipse UserFriend
Hi all,
I have a service (HelloWorldServiceConsumer) that listens the arrival and the departure of another service (HelloWorldService) thanks to the Spring DM declaration

  <osgi:reference id="helloWordlService" interface="org.ztest.dummy.HelloWorldService" cardinality="0..1" >
    <osgi:listener bind-method="onBind" unbind-method="onUnbind" ref="helloWorldServiceConsumer">
    </osgi:listener>
  </osgi:reference>


Every time, I stop or remove the bundle that contains the HelloWorldService, the bundle that holds the HelloWorldServiceConsumer, while I was expecting this bundle to be still kept alive. I was wondering whether it is an expected behavior or not.

In case it is, is it possible to keep the listener bundle alive and how?

I try to add the resolution:=optional on the Import-Package of the HelloWorldService but in this case, I've got a stacktrace.

I have attached an archive that contains the sources and the bundles.

Thanks in advance.
Re: listener (bind-method and unbind-method) bundle behavior when listened service leaves [message #769229 is a reply to message #769216] Wed, 21 December 2011 11:01 Go to previous messageGo to next message
Eclipse UserFriend
The problem is that the consumer imports the package org.ztest.dummy from the service bundle. If you want to avoid impacting the consumer, you should move the package out to a third bundle and have the service bundle and the consumer both depend on that third bundle.
Re: listener (bind-method and unbind-method) bundle behavior when listened service leaves [message #769257 is a reply to message #769229] Wed, 21 December 2011 12:02 Go to previous message
Eclipse UserFriend
You mean separate the api from the implementation for the HelloWorldService?
I should have thought about it! I used to do that but, right now, I have some policy constraints about packaging api and a default implementation both in the same bundle. Sad ... and I forgot this could be cumbersome and problematic...

Anyway, thanks for the quick reply! Apologize for the inconvenience Embarrassed

[Updated on: Wed, 21 December 2011 12:03] by Moderator

Previous Topic:how to export PAR/bundle with my own manifest
Next Topic:Console in virgo 3.0.2
Goto Forum:
  


Current Time: Tue May 20 00:54:09 EDT 2025

Powered by FUDForum. Page generated in 0.04094 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top