Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 15:29 Go to next message
C TRAN-XUAN is currently offline C TRAN-XUANFriend
Messages: 8
Registered: December 2011
Junior Member
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 16:01 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
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 17:02 Go to previous message
C TRAN-XUAN is currently offline C TRAN-XUANFriend
Messages: 8
Registered: December 2011
Junior Member
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 17:03]

Report message to a moderator

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


Current Time: Fri Nov 28 10:12:15 GMT 2014

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

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