public class CounterServer { |
public static org.omg.CORBA.ORB theORB; |
static public void main(String[] args) { |
try { |
theORB = org.omg.CORBA.ORB.init(args, null); |
CountServantImpl servant = new CountServantImpl(); |
theORB.connect(servant); |
org.omg.CORBA.Object objRef = |
theORB.resolve_initial_references("NameService"); |
NamingContext ncRef = NamingContextHelper.narrow(objRef); |
NameComponent nc = new NameComponent("Counter", ""); |
NameComponent path[] = {nc}; |
ncRef.rebind(path, servant); |
java.lang.Object sync = new java.lang.Object(); |
synchronized (sync) { |
sync.wait(); |
} |
} . . . //catch exceptions |
} |