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.

创 建 POAJava:Java:Dictionary _accounts;public:virtual Bank::Account_ptr open(const char* name) {// 在 帐 户 字 典 中 查 找 帐 户 。Bank::Account_ptr account = (Bank::Account_ptr) _accounts.get(name);if(account == Bank::Account::_nil()) {// 准 备 帐 户 余 额 ( 在 0 到 1000 美 元 之 间 )。float balance = abs(rand()) % 100000 / 100.0;// 创 建 帐 户 实 现 , 给 出 余 额 。AccountImpl *accountServant = new AccountImpl(balance);try{// 在 默 认 POA 上 激 活 它 , 该 POA 是 该 服 务 对 象 的 根POAPortableServer::POA_var rootPOA = _default_POA();CORBA::Object_var obj =rootPOA->servant_to_reference(accountServant);account = Bank::Account::_narrow(obj);} catch(const CORBA::Exception& e) {cerr

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

Saved successfully!

Ooh no, something went wrong!