// CountServer.java: The Count Server main program import org.omg.CosNaming.*; import org.omg.CORBA.*; class CountServer { static public void main(String[] args) { try { // Initialize the ORB. org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null); // Initialize the BOA. // org.omg.CORBA.BOA boa = orb.BOA_init(); // Create the Count object. CountImpl count = new CountImpl("My Count"); orb.connect(count); // Register Count object with Naming service org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext ncRef = NamingContextHelper.narrow(objRef); NameComponent nc = new NameComponent("Count", ""); NameComponent path[] = {nc}; ncRef.rebind(path, count); // Wait for client invocations java.lang.Object sync = new java.lang.Object(); synchronized (sync) { sync.wait(); } } catch(Exception e) { System.err.println(e); } } }