|
Lines 36-67
public class Client
Link Here
|
| 36 |
System.exit( -1 ); |
36 |
System.exit( -1 ); |
| 37 |
} |
37 |
} |
| 38 |
|
38 |
|
| 39 |
|
39 |
Properties p = new Properties(); |
|
|
40 |
p.setProperty ("jacorb.log.default.verbosity","4"); |
| 41 |
// contra example |
| 42 |
// p.setProperty ("jacorb.connection.client.disconnect_after_systemexception", "false"); |
| 40 |
// initialize the ORB. |
43 |
// initialize the ORB. |
| 41 |
ORB orb = ORB.init( args, null ); |
44 |
ORB orb = ORB.init( args, p ); |
| 42 |
|
45 |
|
| 43 |
BufferedReader br = |
46 |
BufferedReader br = |
| 44 |
new BufferedReader( new FileReader( f )); |
47 |
new BufferedReader( new FileReader( f )); |
| 45 |
|
48 |
|
| 46 |
// get object reference from command-line argument file |
49 |
String ior = br.readLine (); |
| 47 |
org.omg.CORBA.Object obj = |
|
|
| 48 |
orb.string_to_object( br.readLine() ); |
| 49 |
|
50 |
|
| 50 |
br.close(); |
51 |
br.close(); |
| 51 |
|
52 |
|
| 52 |
// and narrow it to HelloWorld.GoodDay |
53 |
for (int i = 0; i < 5; i++) |
| 53 |
// if this fails, a BAD_PARAM will be thrown |
54 |
{ |
| 54 |
GoodDay goodDay = GoodDayHelper.narrow( obj ); |
55 |
org.omg.CORBA.Object obj = orb.string_to_object( ior ); |
| 55 |
|
56 |
try |
| 56 |
|
57 |
{ |
| 57 |
// invoke the operation and print the result |
58 |
GoodDay goodDay = GoodDayHelper.narrow( obj ); |
| 58 |
System.out.println( goodDay.hello_simple() ); |
59 |
System.out.println( goodDay.hello_simple() ); |
| 59 |
|
60 |
Thread.sleep (10000); |
| 60 |
// invoke the operation again and print the wide string result |
61 |
} |
| 61 |
System.out.println( "wide string: " + |
62 |
catch( OBJECT_NOT_EXIST one) |
| 62 |
goodDay.hello_wide( "Hello World, from 1 2 3 0 *&^%$#@!@")); |
63 |
{ |
| 63 |
|
64 |
Thread.sleep (5000); |
| 64 |
goodDay.shutdown (); |
65 |
br = new BufferedReader( new FileReader( f )); |
|
|
66 |
ior = br.readLine (); |
| 67 |
br.close(); |
| 68 |
} |
| 69 |
} |
| 65 |
} |
70 |
} |
| 66 |
catch( Exception ex ) |
71 |
catch( Exception ex ) |
| 67 |
{ |
72 |
{ |