1 | public class CounterServer { |
2 | public static org.omg.CORBA.ORB theORB; |
3 | static public void main(String[] args) { |
4 | try { |
5 | theORB = org.omg.CORBA.ORB.init(args, null); |
6 | CountServantImpl servant = new CountServantImpl(); |
7 | theORB.connect(servant); |
8 | org.omg.CORBA.Object objRef = |
9 | theORB.resolve_initial_references("NameService"); |
10 | NamingContext ncRef = NamingContextHelper.narrow(objRef); |
11 | NameComponent nc = new NameComponent("Counter", ""); |
12 | NameComponent path[] = {nc}; |
13 | ncRef.rebind(path, servant); |
14 | java.lang.Object sync = new java.lang.Object(); |
15 | synchronized (sync) { |
16 | sync.wait(); |
17 | } |
18 | } . . . //catch exceptions |
19 | } |