use of java.rmi.registry.Registry in project GIPC by pdewan.
the class ComparableCounterServer method main.
public static void main(String[] args) {
try {
Registry rmiRegistry = LocateRegistry.getRegistry();
ComparableCounter counter1 = new AComparableCounter();
ComparableCounter counter2 = new AComparableCounter();
UnicastRemoteObject.exportObject(counter1, 0);
UnicastRemoteObject.exportObject(counter2, 0);
rmiRegistry.rebind(COUNTER1, counter1);
rmiRegistry.rebind(COUNTER2, counter2);
ComparableCounter proxy1 = (ComparableCounter) rmiRegistry.lookup(COUNTER1);
System.out.println(counter1.equals(proxy1));
System.out.println(counter1.hashCode() == proxy1.hashCode());
} catch (Exception e) {
e.printStackTrace();
}
}
use of java.rmi.registry.Registry 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 java.rmi.registry.Registry in project GIPC by pdewan.
the class ADistributedRMIServerMVC_Launcher method launch.
public void launch() {
try {
Registry rmiRegistry = LocateRegistry.getRegistry();
Remote upperCaser = createUpperCaser();
UnicastRemoteObject.exportObject(upperCaser, 0);
rmiRegistry.rebind(upperCaserName(), upperCaser);
} catch (RemoteException e) {
e.printStackTrace();
}
}
use of java.rmi.registry.Registry 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 java.rmi.registry.Registry in project GIPC by pdewan.
the class AnRMIRepositoryServerLauncher method main.
public static void main(String[] args) {
try {
Registry rmiRegistry = LocateRegistry.getRegistry();
RemoteRepository repository = new ARemoteRepository();
UnicastRemoteObject.exportObject(repository, 0);
rmiRegistry.rebind(COUNTER_REPOSITORY, repository);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations