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.

编 写 和 注 册 触 发 器 处 理 器class TriggerHandlerImpl extendscom.inprise.vbroker.ObjLocation.TriggerHandlerPOA {public TriggerHandlerImpl(com.inprise.vbroker.ObjLocation.Agent agent,com.inprise.vbroker.ObjLocation.TriggerDesc initial_desc) {agent = agent;initial_desc = initial_desc;}public void impl_is_ready(com.inprise.vbroker.ObjLocation.Desc desc) {notification(desc, true);}public void impl_is_down(com.inprise.vbroker.ObjLocation.Desc desc) {notification(desc, false);}private void notification(com.inprise.vbroker.ObjLocation.Desc desc,boolean isReady) {if (isReady) {System.out.println("Implementation is ready:");} else {System.out.println("Implementation is down:");}System.out.println("\tRepository Id = " + desc.repository_id + "\n" +"\tInstance Name = " + desc.instance_name + "\n" +"\tHost Name = " + desc.iiop_locator.host + "\n" +"\tBOA Port = " + desc.iiop_locator.port + "\n" +"\tActivable = " + desc.activable + "\n" + "\n");System.out.println("Unregister this handler and exit (yes/no)?");try {BufferedReader in = new BufferedReader(new InputStreamReader(System.in));String line = in.readLine();if(line.startsWith("y") || line.startsWith("Y")) {try {agent.unreg_trigger(_initial_desc, _this());} catch (com.inprise.vbroker.ObjLocation.Fail e) {System.out.println("Failed to unregister trigger with reason=["+e.reason + "]");}System.out.println("exiting...");System.exit(0);}} catch (java.io.IOException e) {System.out.println("Unexpected exception caught: " + e);System.exit(1);}}private com.inprise.vbroker.ObjLocation.Agent _agent;private com.inprise.vbroker.ObjLocation.TriggerDesc _initial_desc;}public class AccountTrigger {public static void main(String args[]) {try {// 初 始 化 ORB。org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,null);使 用 定 位 服 务 13-15

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

Saved successfully!

Ooh no, something went wrong!