use of examples.mvc.rmi.duplex.DistributedRMICounter in project GIPC by pdewan.
the class AGIPCCounterClient method test.
public static void test(GIPCRegistry gipcRegistry, Class aLookedupClass) {
DistributedRMICounter counter11 = (DistributedRMICounter) gipcRegistry.lookup(aLookedupClass, COUNTER1);
DistributedRMICounter counter12 = (DistributedRMICounter) gipcRegistry.lookup(aLookedupClass, COUNTER1);
DistributedRMICounter counter2 = (DistributedRMICounter) gipcRegistry.lookup(aLookedupClass, COUNTER2);
AnRMICounterClient.doOperations(counter11, counter12, counter2);
}
use of examples.mvc.rmi.duplex.DistributedRMICounter in project GIPC by pdewan.
the class ACounterSessionMember method doOperations.
public static void doOperations() {
try {
Set<String> aMembers = gipcRegistry.getAllMembers();
for (String aMember : aMembers) {
DistributedRMICounter aMemberCounter = (DistributedRMICounter) gipcRegistry.lookup(aMember, COUNTER_NAME);
aMemberCounter.increment(Integer.parseInt(aMember));
}
DistributedRMICounter anAllRemoteCounter = (DistributedRMICounter) gipcRegistry.lookupAllRemote(COUNTER_NAME);
// anAllRemoteCounter.increment(2);
System.out.println("All remote counter values:" + anAllRemoteCounter.getValue());
DistributedRMICounter anAllRemoteAndMeCounter = (DistributedRMICounter) gipcRegistry.lookupAll(COUNTER_NAME);
// anAllRemoteCounter.increment(2);
System.out.println("All remote and me counter values:" + anAllRemoteAndMeCounter.getValue());
} catch (RemoteException e) {
e.printStackTrace();
}
}
use of examples.mvc.rmi.duplex.DistributedRMICounter in project GIPC by pdewan.
the class AnRMICounterClient method main.
public static void main(String[] args) {
try {
Registry rmiRegistry = LocateRegistry.getRegistry();
DistributedRMICounter counter11 = (DistributedRMICounter) rmiRegistry.lookup(COUNTER1);
DistributedRMICounter counter12 = (DistributedRMICounter) rmiRegistry.lookup(COUNTER1);
DistributedRMICounter counter2 = (DistributedRMICounter) rmiRegistry.lookup(COUNTER2);
doOperations(counter11, counter12, counter2);
} catch (Exception e) {
e.printStackTrace();
}
}
use of examples.mvc.rmi.duplex.DistributedRMICounter in project GIPC by pdewan.
the class AnRMIRepositoryClientLauncher method main.
public static void main(String[] args) {
try {
Registry rmiRegistry = LocateRegistry.getRegistry();
RemoteRepository counterRepository = (RemoteRepository) rmiRegistry.lookup(COUNTER_REPOSITORY);
DistributedRMICounter exportedCounter = new ADistributedInheritingRMICounter();
UnicastRemoteObject.exportObject(exportedCounter, 0);
counterRepository.deposit(exportedCounter);
exportedCounter.increment(1);
List<Remote> objects = counterRepository.getObjects();
for (Remote counter : objects) {
System.out.println(((DistributedRMICounter) counter).getValue());
System.out.println(counter == exportedCounter);
System.out.println(counter.equals(exportedCounter));
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of examples.mvc.rmi.duplex.DistributedRMICounter in project GIPC by pdewan.
the class RemoteCounterClientLauncher method main.
public static void main(String[] args) {
try {
Registry rmiRegistry = LocateRegistry.getRegistry();
DistributedRMICounter counter = (DistributedRMICounter) rmiRegistry.lookup(DistributedRMICounter.class.getName());
System.out.println(counter.getValue());
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations