Skip to main content



      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 00:59 Go to next message
Eclipse UserFriend
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 02:41 Go to previous messageGo to next message
Eclipse UserFriend
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 15:41 Go to previous message
Eclipse UserFriend
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: Wed May 07 13:10:44 EDT 2025

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

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

Back to the top