01: package demo.mtclient;
02:
03: //
04: // Server for multi-threaded client
05: //
06:
07: import org.omg.CosNaming.*;
08: import org.omg.PortableServer.*;
09:
10: public class Server {
11: public static void main(String[] args) {
12: org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
13: try {
14: POA poa = POAHelper.narrow(orb
15: .resolve_initial_references("RootPOA"));
16:
17: poa.the_POAManager().activate();
18:
19: org.omg.CORBA.Object o = poa
20: .servant_to_reference(new serverImpl());
21: // register server with naming context
22:
23: NamingContextExt nc = NamingContextExtHelper.narrow(orb
24: .resolve_initial_references("NameService"));
25:
26: nc.bind(nc.to_name("Thread.example"), o);
27:
28: } catch (Exception e) {
29: e.printStackTrace();
30: }
31: orb.run();
32: }
33: }
|