Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » osgi:list with a listener to a bean with prototype scope
osgi:list with a listener to a bean with prototype scope [message #1008570] Wed, 13 February 2013 05:59 Go to next message
Daniel McGreal is currently offline Daniel McGrealFriend
Messages: 27
Registered: April 2012
Junior Member
Hi, is the below scenario possible?

	<osgi:list cardinality="0..N" id="list" interface="Service">
		<osgi:listener ref="prototypeBean" bind-method="registerService" unbind-method="deregisterService"></osgi:listener>
	</osgi:list>
	
	<bean id="prototypeBean" class="SomeBeanClass" scope="prototype"></bean>


With this code, a new prototypeBean is instantiated at context load time and its listener methods are called when list changes. However, new prototypeBeans do not receive the callbacks.

Is it possible instead that the listener methods are called on new instances of prototypeBean (and ideally that no prototypeBean is instantiated at context load time).

Thanks, Dan.
Re: osgi:list with a listener to a bean with prototype scope [message #1107258 is a reply to message #1008570] Thu, 12 September 2013 06:41 Go to previous messageGo to next message
Soniya Chavan is currently offline Soniya ChavanFriend
Messages: 4
Registered: September 2013
Junior Member
Did you find a solution to this? I am facing this same problem.
Re: osgi:list with a listener to a bean with prototype scope [message #1112487 is a reply to message #1107258] Thu, 19 September 2013 19:41 Go to previous message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 123
Registered: January 2012
Senior Member
I think that this is not the Idea.
If the bean is prototype, it will be created when the service list needs. The list will not track new instances of this Bean to notify.

If its the Idea, I recommend that you create some kind of service tracker (not necessarily an OSGi service tracker).

This tracker will be linked on tracked services, and can have listeners to notify they lifecicle.

So, you can Inject this tracker in your prototype bean, and register itself to listen about an specific service.

Hope that helps.
Previous Topic:Mixing Blueprint and Spring namespaces in configuration files
Next Topic:ATTN: Gemini Management subproject about to be shut down!
Goto Forum:
  


Current Time: Mon Dec 09 16:42:48 GMT 2024

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

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

Back to the top