1 22 package org.jboss.iiop; 23 24 import javax.naming.InitialContext ; 25 26 import org.jboss.corba.ORBFactory; 27 import org.omg.CORBA.ORB ; 28 29 39 public class CorbaORB 40 { 41 42 private static ORB instance; 43 44 45 private CorbaORB() 46 { 47 } 48 49 53 static void setInstance(ORB orb) 54 { 55 if (instance == null) 56 instance = orb; 57 else 58 throw new RuntimeException (CorbaORB.class.getName() 59 + ".setInstance() called more than once"); 60 } 61 62 72 public static ORB getInstance() 73 { 74 if (instance == null) 77 { 78 try 79 { 80 InitialContext ctx = new InitialContext (); 81 ORB orb = (ORB ) ctx.lookup("java:comp/ORB"); 82 } 83 catch (Exception ignored) 84 { 85 } 86 if (instance == null) 87 instance = ORBFactory.getORB(); 88 } 89 return instance; 90 } 91 } 92 | Popular Tags |