3
import org.omg.CosNaming.*;
6
* This class implements the server side of the example.
8
* $PostgreSQL: pgjdbc/example/corba/StockServer.java,v 1.7 2004/11/09 08:43:20 jurka Exp $
10
public class StockServer
12
public static void main(String[] args)
19
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
21
// Create the StockDispenser object
22
StockDispenserImpl dispenser = new StockDispenserImpl(args, "Stock Dispenser", numInstances);
24
// Export the new object
25
orb.connect(dispenser);
27
// Get the naming service
28
org.omg.CORBA.Object nameServiceObj = orb.resolve_initial_references("NameService");
29
if (nameServiceObj == null)
31
System.err.println("nameServiceObj = null");
35
org.omg.CosNaming.NamingContext nameService = org.omg.CosNaming.NamingContextHelper.narrow(nameServiceObj);
36
if (nameService == null)
38
System.err.println("nameService = null");
42
// bind the dispenser into the naming service
43
NameComponent[] dispenserName = {
44
new NameComponent("StockDispenser", "Stock")
46
nameService.rebind(dispenserName, dispenser);
48
// Now wait forever for the current thread to die
49
Thread.currentThread().join();