Package ca.evanjones.protorpc.Counter

Examples of ca.evanjones.protorpc.Counter.CounterService


        // Set up the connection to the server
        NIOEventLoop eventLoop = new NIOEventLoop();
        ProtoRpcChannel[] channels = ProtoRpcChannel.connectParallel(eventLoop,
                new InetSocketAddress[] {new InetSocketAddress(host, port)});
//        ProtoRpcChannel channel = new ProtoRpcChannel(eventLoop, new InetSocketAddress(host, port));
        CounterService stub = CounterService.newStub(channels[0]);
        ProtoRpcController rpc = new ProtoRpcController();
        StoreResultCallback<Value> callback = new StoreResultCallback<Value>();

        // Build the request
        if (isGet) {
            stub.get(rpc, GetRequest.getDefaultInstance(), callback);
            rpc.block();
            System.out.println("get = " + callback.getResult().getValue());
        } else {
            stub.add(rpc, Value.newBuilder().setValue(increment).build(), callback);
            rpc.block();
            System.out.println("counter + " + increment + " = " + callback.getResult().getValue());
        }
    }
View Full Code Here

TOP

Related Classes of ca.evanjones.protorpc.Counter.CounterService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.