12.07.2015 Views

VisiBroker Edition

VisiBroker Edition

VisiBroker Edition

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

使 用 服 务 激 活 方 法Java:这 是 一 个 在 Java 下 忽 略 激 活 和 去 激 活 的 实 例 。// Server.java实 现 Activator 的 DBActivator 类 {private static int _count;private com.inprise.vbroker.CORBA.BOA _boa;public DBActivator(com.inprise.vbroker.CORBA.BOA boa) {_boa = boa;}public org.omg.CORBA.Object activate(com.inprise.vbroker.extension.ImplementationDef impl) {System.out.printIn("Activator called " + ++_count + " times");byte[] ref_data = ((ActivationImplDef) impl).id();DBObjectImpl obj = new DBObjectImpl(new String(ref_data));_boa.obj_is_ready(obj);return obj;}public void deactivate(org.omg.CORBA.Object obj, ImplementationDef impl) {// 这 里 什 么 也 不 用 做 ......}}如 下 文 所 示 , DBActivator 类 基 于 其 在 C++ 下 的 CORBA::ReferenceData 参 数 创 建了 一 个 对 象 。 当 BOA 收 到 一 个 对 由 Activator 负 责 的 对 象 所 作 的 客 户 请 求 时 ,BOA 调 用 Activator 上 的 activate 方 法 。 在 调 用 该 方 法 时 , BOA 通 过 给Activator 传 送 一 个 ImplementationDef 参 数 来 唯 一 地 识 别 激 活 的 对 象 实 现 , 实 现可 以 从 其 中 得 到 C++ CORBA::ReferenceData 或 Java ReferenceData -- 所 请 求 的 对象 的 唯 一 标 识 。C++: CORBA::Object_ptr DBActivator::activate(CORBA::ImplementationDef_ptr impl) {extension::ActivationImplDef* actImplDef =extension::ActivationImplDef::_downcast(impl);CORBA::ReferenceData_var id(actImplDef->id());cout

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

Saved successfully!

Ooh no, something went wrong!