use of examples.mvc.local.duplex.Counter in project GIPC by pdewan.
the class ADistributedRMIClientMVC_Launcher method getCounter.
@Override
protected Counter getCounter() {
DistributedRMICounter counter = new ADistributedInheritingRMICounter();
try {
UnicastRemoteObject.exportObject(counter, 0);
Registry clientRMIRegistry = LocateRegistry.getRegistry();
clientRMIRegistry.rebind(counterName(), counter);
} catch (Exception e) {
e.printStackTrace();
}
return (Counter) counter;
}
use of examples.mvc.local.duplex.Counter in project GIPC by pdewan.
the class ASessionPortCounterClientLauncher method createUI.
@Override
protected void createUI(InputPort anInputPort) {
Scanner aScanner = new Scanner(System.in);
for (; ; ) {
System.out.println("Enter user name whose counter is to be incremented:");
String aName = aScanner.nextLine();
Counter aCounter = (Counter) DirectedRPCProxyGenerator.generateRPCProxy((DuplexRPCSessionPort) mainPort, aName, ACounter.class, null);
aCounter.increment(1);
System.out.println("New counter value:" + aCounter.getValue());
}
}
Aggregations