12.07.2015 Views

VisiBroker Edition

VisiBroker Edition

VisiBroker Edition

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

可 移 植 接 收 器 和 信 息 接 口其 中 , 是 实 现org.omg.PortableInterceptor.ORBInitializer 的 类 的 字 串 名 称 。在 ORB.init( ) 的 过 程 中 ,1 以 org.omg.PortableInterceptor.ORBInitializerClass 开 头 的 ORB 属 性 被 收集 在 一 起 ;2 每 个 属 性 的 部 分 将 被 收 集 起 来 ;3 一 个 对 象 将 被 实 例 化 , 并 将 字 串 作 为 它 的 类 名 称 ;4 在 该 对 象 上 将 调 用 pre_init( ) 和 post_init( ) 方 法 。5 如 果 发 生 任 何 违 例 , ORB 忽 略 它 们 继 续 运 行 。注 : 为 避 免 名 称 冲 突 , 推 荐 使 用 反 解 DNS 名 称 惯 例 。 例 如 , 如 果 ABC 公 司 有 两 个 初值 设 定 列 (initializer), 则 它 可 以 定 义 以 下 属 性 :org.omg.PortableInterceptor.ORBInitializerClass.com.abc.ORBInit1org.omg.PortableInterceptor.ORBInitializerClass.com.abc.ORBInit2C++: 在 PortableInterceptor 模 块 中 定 义 register_orb_initializer 方 法 的 命 令 如 下 :class _VISEXPORT PortableInterceptor {static void register_orb_initializer(ORBInitializer *init);}实 例Java:由 ABC 公 司 编 写 的 客 户 端 监 视 工 具 可 以 具 有 以 下 的 ORBInitializer 实 现 :package com.abc.Monitoring;import org.omg.PortableInterceptor.Intercepor;import org.omg.PortableInterceptor.ORBInitializer;import org.omg.PortableInterceptor.ORBInitInfo;public class MonitoringService extends org.omg.CORBA.LocalObjectimplements org.omg.PortableInterceptor.ORBInitializer{void pre_init(ORBInitInfo info){// 实 例 化 服 务 的 接 收 器Interceptor interceptor = new MonitoringInterceptor();// 注 册 Monitoring 的 接 收 器 。info.add_client_request_interceptor(interceptor);}void post_init(ORBInitInfo info){// 这 个 init 点 不 是 必 要 的 。}}可 以 用 以 下 的 命 令 来 运 行 命 名 为 MyApp 的 使 用 该 监 视 服 务 的 程 序 :20-12 <strong>VisiBroker</strong> 开 发 者 指 南

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!