ITeye博客

JacORB开发Corba客户端

agile_boy · 2008-10-22 20:33 · java · 企业架构 · 工作 · Markdown

Corba算是比较古老的分布式系统了,因为工作需要,需要访问Corba的服务器(也是用JacORB)实现的一套系统,其实就是TMF814相关规范的Corba实现,以下是摸索的点滴,在此稍作记录,以防忘记。

访问服务器的几种方式

IOR的方式,就是将服务信息导出为字符串,直接传给客户端相关代码 ORBInitRef.NameService,比如:corbaloc::172.31.0.140:13000/NameService

JacORB的几个特殊属性

			prop.put( "org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB" );
			prop.put( "org.omg.CORBA.ORBSingletonClass",
			"org.jacorb.orb.ORBSingleton" );		

双向IIOP的访问 首先需要设置属性:

prop.put( "org.omg.PortableInterceptor.ORBInitializerClass.bidir_init",
			"org.jacorb.orb.giop.BiDirConnectionInitializer");

其次激活特定的POA Manager,代码如下:

				Any any = orb.create_any();
				BidirectionalPolicyValueHelper.insert(any, BOTH.value);
				Policy[] policies = new Policy[1];
				 policies[0] = orb.create_policy(
				 BIDIRECTIONAL_POLICY_TYPE.value, any);

				org.omg.PortableServer.POA poa = root_poa.create_POA(
						"BiDirPOA", root_poa.the_POAManager(), policies);
				poa.the_POAManager().activate();

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。