First page Back Continue Last page Summary Graphics
Ejemplo de Interconectividad
CountServer.java
- import Counter.*;
- import org.omg.CosNaming.*;
- import org.omg.CosNaming.NamingContextPackage.*;
- import org.omg.CORBA.*;
- class CountServer {
- public static void main (String args[]) {
- try {
- ORB orb = ORB.init(args,null);
- CountImpl counter = new CountImpl();
- orb.connect(counter);
- 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,counter);
- java.lang.Object sync = new java.lang.Object();
- synchronized(sync) {
- sync.wait();
- }
catch (Exception e) {
System.err.println(e);
e.printStackTrace(System.out);
}
}
}