use of java.rmi.registry.Registry in project GIPC by pdewan.
the class AMixedTypeArithmeticDoubleSetterAndDisplayerLauncher method main.
public static void main(String[] args) {
try {
Registry rmiRegistry = LocateRegistry.getRegistry();
RemoteStatefulMixedTypeProcessor mixedTypeProcessor = (RemoteStatefulMixedTypeProcessor) rmiRegistry.lookup(MixedTypeAirthmeticServer.SERVER_NAME);
Scanner scan = new Scanner(System.in);
System.out.println("Please input a decimal");
double num2 = scan.nextDouble();
mixedTypeProcessor.setDouble(num2);
Integer intAddition = mixedTypeProcessor.intAdd();
Double doubleAddition = mixedTypeProcessor.doubleAdd();
Integer intMultiply = mixedTypeProcessor.intMultiply();
Double doubleMultiply = mixedTypeProcessor.doubleMultiply();
// need to print out only initialized values otherwise the grading goes wrong
if (intAddition != null)
System.out.println("The int addition:" + intAddition);
if (doubleAddition != null)
System.out.println("The double addition:" + doubleAddition);
if (intMultiply != null)
System.out.println("The int multiplication:" + intMultiply);
if (doubleMultiply != null)
System.out.println("The double multiplication:" + doubleMultiply);
} catch (Exception e) {
e.printStackTrace();
}
}
use of java.rmi.registry.Registry in project GIPC by pdewan.
the class AStatefulMixedTypeArithmeticServerLauncher method main.
public static void main(String[] args) {
try {
Registry rmiRegistry = LocateRegistry.getRegistry();
RemoteStatefulMixedTypeProcessor mixedTypeProcessor = new AStatefulMixedTypeProcessor();
// create proxy
UnicastRemoteObject.exportObject(mixedTypeProcessor, 0);
// make it available for clients
rmiRegistry.rebind(SERVER_NAME, mixedTypeProcessor);
} catch (Exception e) {
e.printStackTrace();
}
}
use of java.rmi.registry.Registry 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 java.rmi.registry.Registry 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 java.rmi.registry.Registry 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