First page Back Continue Last page Summary Graphics
Cliente
CountClient.java :
import Counter.*;
import org.omg.CosNaming.*;
import org.omg.CORBA.*;
class CountClient {
public static void main (String[] args) {
try {
ORB orb = ORB.init(args,null);
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef);
NameComponent nc = new NameComponent("Count", "");
NameComponent path[] = {nc};
Count counter = CountHelper.narrow(ncRef.resolve(path));
- counter.sum(0);
- for ( int i=0; i<1000; i++) {
- counter.increment();
- }
- }
- catch ( Exception e) {
- System.err.println(e);
- e.printStackTrace(System.out);
- }
- }
- }