Java Reference
In-Depth Information
//'Narrow' ('downcast') context reference…
NamingContext namingContext =
NamingContextHelper.narrow(objectRef);
//Create a NameComponent object for the
// StockItem interface…
NameComponent nameComp =
new NameComponent("Stock", "");
//Specify the path to the interface…
NameComponent[] stockPath = {nameComp};
//Bind the servant to the interface path…
namingContext.rebind(stockPath,stockServant);
//Create a NameComponent object for the
// StockFactory interface…
NameComponent factoryNameComp =
new NameComponent("StockFactory", "");
//Specify the path to the interface…
NameComponent[] factoryPath =
{factoryNameComp};
//Bind the servant to the interface path…
namingContext.rebind(
factoryPath,factoryServant);
System.out.print("\nServer running…");
java.lang.Object syncObj =
new java.lang.Object();
synchronized(syncObj)
{
syncObj.wait();
}
}
catch (Exception ex)
{
System.out.println("*** Server error! ***");
ex.printStackTrace();
}
}
}
class StockItemServant extends _StockItemImplBase
{
//Code as shown in step 3 above.
}
Search WWH ::




Custom Search