Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » SynchronousBundleListener
SynchronousBundleListener [message #997428] Mon, 07 January 2013 13:34 Go to next message
Daniel McGreal is currently offline Daniel McGrealFriend
Messages: 12
Registered: January 2013
Junior Member
Hi, I have a question regarding the use of SynchronousBundleListeners in a Virgo 3.5 environment.

I have a service, S, running in a bundle, B1 which receives anonymously created objects, O, from a second bundle B2. I need to make this environment react to the the lifecycle of both B1 and B2. So; when B1 is refreshed, the object created by B2 needs to be registered again with the new service S, when B2 is refreshed I need to deregister O such that when B2 initialises again and registers a new O there are not any references to the previous anonymous object in S.

Supposing this is reasonable, I have a SynchronousBundleListener which deregisters O from S when B2 is BundleEvent.STOPPING and reregisters O into S when B1 is BundleEvent.STARTED.

This usually works fine, sometimes however, S's proxy has been destroyed during my SynchronousBundleListener's response to the BundleEvent.STOPPING. My understanding has been that the SynchronousBundleListener should be fully executed before further lifecycle events take place.

How have I misunderstood, and is there a different/standard way of achieving the above? I'm thinking of publishing my Os as services and use a list of them and binding methods in S.
Many thanks in advance,
Dan.
Re: SynchronousBundleListener [message #997459 is a reply to message #997428] Mon, 07 January 2013 15:51 Go to previous messageGo to next message
Daniel McGreal is currently offline Daniel McGrealFriend
Messages: 12
Registered: January 2013
Junior Member
So I went ahead and used the services approach, and all was wonderful - thanks.
Re: SynchronousBundleListener [message #997467 is a reply to message #997459] Mon, 07 January 2013 16:31 Go to previous message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
The services approach sounds right as it is not clear that you actually want to bind together the lifecycles of B1 and B2 or have them be aware of each other's existence. If services come and go for any reason, it seems you would want to react accordingly.

If you want to simplify your code, you might look into using Gemini Blueprint.
Previous Topic:New Import-Package not resolved on hot-deploy
Next Topic:Virgo Snaps question
Goto Forum:
  


Current Time: Sun Dec 21 01:16:41 GMT 2014

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

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