1 package test.connection.timeout; 2 3 import org.omg.CosNaming.*; 4 5 public class Client 6 { 7 public static void main(String args[]) 8 { 9 try 10 { 11 MyServer grid; 12 13 org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null); 14 15 if( args.length == 1 ) 16 { 17 grid = MyServerHelper.narrow(orb.string_to_object(args[0])); 19 } 20 else 21 { 22 NamingContextExt nc = 23 NamingContextExtHelper.narrow( 24 orb.resolve_initial_references( "NameService" )); 25 26 org.omg.CORBA.Object o = 27 nc.resolve(nc.to_name("grid.example")); 28 29 grid = MyServerHelper.narrow(o); 30 31 } 32 33 short x = -1; 34 short y = -1; 35 try 36 { 37 x = grid.height(); 38 } 39 catch (org.omg.CORBA.IMP_LIMIT e) 40 { 41 e.printStackTrace(); 42 } 43 44 System.out.println("Height = " + x); 45 try 46 { 47 y = grid.width(); 48 } 49 catch (org.omg.CORBA.IMP_LIMIT e) 50 { 51 e.printStackTrace(); 52 } 53 54 System.out.println("Width = " + y); 55 56 57 orb.shutdown(true); 58 System.out.println("done. "); 59 60 } 61 catch (Exception e) 62 { 63 e.printStackTrace(); 64 } 65 } 66 } 67 68 69 | Popular Tags |