use of examples.mvc.rmi.duplex.DistributedRMICounter in project GIPC by pdewan.
the class AGIPCCounterServer method main.
public static void main(String[] args) {
try {
GIPCRegistry gipcRegistry = GIPCLocateRegistry.createRegistry(SERVER_PORT);
DistributedRMICounter counter1 = new ADistributedInheritingRMICounter();
DistributedRMICounter counter2 = new ADistributedInheritingRMICounter();
gipcRegistry.rebind(COUNTER1, counter1);
gipcRegistry.rebind(COUNTER2, counter2);
DistributedRMICounter fetchedCounter = (DistributedRMICounter) gipcRegistry.lookup(DistributedRMICounter.class, COUNTER1);
AnRMICounterServer.doOperations(counter1, counter2, fetchedCounter);
} catch (Exception e) {
e.printStackTrace();
}
}
use of examples.mvc.rmi.duplex.DistributedRMICounter in project GIPC by pdewan.
the class AnRMICounterServer method main.
public static void main(String[] args) {
try {
Registry rmiRegistry = LocateRegistry.getRegistry();
DistributedRMICounter counter1 = new ADistributedInheritingRMICounter();
DistributedRMICounter counter2 = new ADistributedInheritingRMICounter();
UnicastRemoteObject.exportObject(counter1, 0);
UnicastRemoteObject.exportObject(counter2, 0);
rmiRegistry.rebind(COUNTER1, counter1);
rmiRegistry.rebind(COUNTER2, counter2);
DistributedRMICounter fetchedCounter = (DistributedRMICounter) rmiRegistry.lookup(COUNTER1);
doOperations(counter1, counter2, fetchedCounter);
} catch (Exception e) {
e.printStackTrace();
}
}
use of examples.mvc.rmi.duplex.DistributedRMICounter in project GIPC by pdewan.
the class ASimpleRMICounterClient method main.
public static void main(String[] args) {
try {
Registry rmiRegistry = LocateRegistry.getRegistry(SERVER_HOST_NAME, SERVER_PORT);
DistributedRMICounter counter = (DistributedRMICounter) rmiRegistry.lookup(COUNTER_NAME);
counter.increment(1);
System.out.println(counter.getValue());
} catch (Exception e) {
e.printStackTrace();
}
}
use of examples.mvc.rmi.duplex.DistributedRMICounter in project GIPC by pdewan.
the class RemoteCounterServerLauncher method main.
public static void main(String[] args) {
try {
Registry rmiRegistry = LocateRegistry.getRegistry();
DistributedRMICounter counter = new ADistributedDelegatingRMICounter();
// this is what sends a remote rather than serializable version of the object
UnicastRemoteObject.exportObject(counter, 0);
// rmiRegistry.rebind(Counter.class.getName(), exportedCounter);
rmiRegistry.rebind(DistributedRMICounter.class.getName(), counter);
counter.increment(50);
} catch (Exception e) {
e.printStackTrace();
}
}
use of examples.mvc.rmi.duplex.DistributedRMICounter in project GIPC by pdewan.
the class ASimpleRMIRegistryAndCounterServer method main.
public static void main(String[] args) {
try {
Registry rmiRegistry = LocateRegistry.createRegistry(SERVER_PORT);
DistributedRMICounter counter = new ADistributedInheritingRMICounter();
UnicastRemoteObject.exportObject(counter, 0);
rmiRegistry.rebind(COUNTER_NAME, counter);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations