You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@aries.apache.org by qiujiahaook <qi...@qq.com> on 2015/04/01 03:40:56 UTC

blueprint scope

I hava a implement bundle HelloServiceImp:


public class HelloServiceImp implements HelloService
{


	private int num=0;
	
	
	public void add() {
		num++;
		System.out.println("HelloServiceImp:add:num="+num);
	}
	  
}

‍

the blueprint config :
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
        <bean id="helloserviceimp"  class="com.cn.qjh.HelloServiceImp.HelloServiceImp" scope="prototype" ></bean>
        <service ref="helloserviceimp" interface="com.cn.qjh.HelloService.HelloService" />
</blueprint>‍



I write two client bundle to call  service(add),then print num value and inject object hashcode.


I found the inject object hashcode in two client bundle is same, and the num value is associated.‍


I config the  scope="prototype" , I think the two inject object is not same,but not. 

thanks! 




‍

RE: blueprint scope

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
Hello,

Prototypes statically creates beans, i.e. creates one bean per XML reference to it. Not related to execution calls.

What are you trying to do?

JP

[@@ OPEN @@]

De : qiujiahaook [mailto:qiujiahaook@qq.com]
Envoyé : mercredi 1 avril 2015 03:41
À : user
Objet : blueprint scope

I hava a implement bundle HelloServiceImp:

public class HelloServiceImp implements HelloService
{

            private int num=0;


            public void add() {
                        num++;
                        System.out.println("HelloServiceImp:add:num="+num);
            }

}
‍
the blueprint config :
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
        <bean id="helloserviceimp"  class="com.cn.qjh.HelloServiceImp.HelloServiceImp" scope="prototype" ></bean>
        <service ref="helloserviceimp" interface="com.cn.qjh.HelloService.HelloService" />
</blueprint>‍

I write two client bundle to call  service(add),then print num value and inject object hashcode.

I found the inject object hashcode in two client bundle is same, and the num value is associated.‍

I config the  scope="prototype" , I think the two inject object is not same,but not.

thanks!


‍