public CryoBay reconnectServer(ORB o, ReconnectThread rct) { BufferedReader reader; File file; ORB orb; org.omg.CORBA.Object obj; orb = o; obj = null; cryoB = null; try { // instantiate ModuleAccessor file = new File("/vnmr/acqqueue/cryoBay.CORBAref"); if (file.exists()) { reader = new BufferedReader(new FileReader(file)); obj = orb.string_to_object(reader.readLine()); } if (obj != null) { cryoB = CryoBayHelper.narrow(obj); } if (cryoB != null) { if (!(cryoB._non_existent())) { // System.out.println("reconnected!!!!"); rct.reconnected = true; } } } catch (Exception e) { // System.out.println("Got error: " + e); } return cryoB; }
public static void main(String[] args) { ORB orb = null; orb = ORB.init(args, null); if (orb != null) { try { new ClientGui(orb); } catch (Exception e) { System.err.println(e); System.exit(-1); } } else { System.err.println("can't initiate orb"); System.exit(-1); } } /*end of main*/
public ClientGui(ORB o) throws Exception { ShutdownFrame sf; BufferedReader reader; boolean modulePresent; File file; CryoThread update; orb = o; obj = null; cryoBay = null; // System.out.println("running test client."); // instantiate ModuleAccessor file = new File("/vnmr/acqqueue/cryoBay.CORBAref"); if (file.exists()) { reader = new BufferedReader(new FileReader(file)); obj = orb.string_to_object(reader.readLine()); } if (obj == null) { throw new Exception("string_to_object is null: cryoBay.CORBAref"); } // System.out.println("Got object."); cryoBay = CryoBayHelper.narrow(obj); if (cryoBay == null) { throw new Exception("cryoBay is null"); } if (cryoBay._non_existent()) { throw new Exception("cryoBay is not running"); } sf = new ShutdownFrame(cryoBay); update = new CryoThread(cryoBay, sf, this); sf.show(); update.start(); } /*end of constructor*/