1 package test.load.imr; 2 3 import java.io.*; 4 import java.util.*; 5 import org.omg.CORBA.*; 6 7 public class Client 8 { 9 public static void main( String args[] ) 10 { 11 if( args.length != 1 ) 12 { 13 System.out.println( "Usage: jaco test.load.imr.Client <ior_file>" ); 14 System.exit( 1 ); 15 } 16 17 try 18 { 19 File f = new File( args[ 0 ] ); 20 21 if( ! f.exists() ) 23 { 24 System.out.println("File " + args[0] + 25 " does not exist."); 26 27 System.exit( -1 ); 28 } 29 30 if( f.isDirectory() ) 32 { 33 System.out.println("File " + args[0] + 34 " is a directory."); 35 36 System.exit( -1 ); 37 } 38 39 ORB orb = ORB.init( args, null ); 41 42 BufferedReader br = 43 new BufferedReader( new FileReader( f )); 44 45 org.omg.CORBA.Object obj = 47 orb.string_to_object( br.readLine() ); 48 49 br.close(); 50 51 GoodDay goodDay = GoodDayHelper.narrow( obj ); 54 55 for( int i = 0; i < 40; i++ ) 56 { 57 Thread th = new Thread ( new CallRunnable( goodDay, i )); 58 th.start(); 59 } 60 } 61 catch( Exception ex ) 62 { 63 System.err.println( ex ); 64 } 65 } 66 67 private static class CallRunnable 68 implements Runnable 69 { 70 private int me = 0; 71 private GoodDay good_day = null; 72 private Random rnd = null; 73 74 public CallRunnable( GoodDay good_day, 75 int me ) 76 { 77 this.good_day = good_day; 78 this.me = me; 79 80 rnd = new Random(); 81 } 82 83 public void run() 84 { 85 try 86 { 87 good_day.hello_simple( me ); 90 91 } 94 catch( Throwable th ) 95 { 96 th.printStackTrace(); 97 98 System.exit( -1 ); 99 } 100 } 101 } 102 } 103 104 | Popular Tags |