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.

使 用 服 务 对 象 和 服 务 对 象 管 理 器ref =myPOA.create_reference_with_id("SavingsAccountManager".getBytes(),"IDL:Bank/AccountManager:1.0");// 写 出 储 蓄 对 象 IDpw = new java.io.PrintWriter( new java.io.FileWriter("sref.dat") );System.gc();pw.println(orb.object_to_string(ref));pw.close();} catch ( java.io.IOException e ) {System.out.println("Error writing the IOR to file ");return;}System.out.println("BankManager is ready.");// 等 待 进 入 的 请 求 。orb.run();} catch (Exception e) {e.printStackTrace();}}}本 例 的 服 务 对 象 管 理 器 如 下 。C++:// 服 务 对 象 定 位 器class AccountManagerLocator :public PortableServer::ServantLocator {public:AccountManagerLocator (){}// 预 调 用 与 ServantActivator 的 incarnate ( 实 例 化 ) 方 法 非 常 相 似 , 但 是 , 每 当 有请 求 进 入 时// 被 调 用 , 这 一 点 与 incarnate() 方 法 不 同 , 该 方 法 是 每 当// POA 在 活 动 对 象 图 上 找 不 到 一 个 服 务 对 象 时 被 调 用 的virtual PortableServer::Servant preinvoke (const PortableServer::ObjectId& oid,PortableServer::POA_ptr adapter,const char* operation,PortableServer::ServantLocator::Cookie& the_cookie) {CORBA::String_var s = PortableServer::ObjectId_to_string (oid);cout

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

Saved successfully!

Ooh no, something went wrong!