Search in sources :

Example 6 with DistributedRMICounter

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();
    }
}
Also used : DistributedRMICounter(examples.mvc.rmi.duplex.DistributedRMICounter) ADistributedInheritingRMICounter(examples.mvc.rmi.duplex.ADistributedInheritingRMICounter) GIPCRegistry(inputport.rpc.GIPCRegistry)

Example 7 with DistributedRMICounter

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();
    }
}
Also used : DistributedRMICounter(examples.mvc.rmi.duplex.DistributedRMICounter) ADistributedInheritingRMICounter(examples.mvc.rmi.duplex.ADistributedInheritingRMICounter) LocateRegistry(java.rmi.registry.LocateRegistry) Registry(java.rmi.registry.Registry)

Example 8 with DistributedRMICounter

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();
    }
}
Also used : DistributedRMICounter(examples.mvc.rmi.duplex.DistributedRMICounter) LocateRegistry(java.rmi.registry.LocateRegistry) Registry(java.rmi.registry.Registry)

Example 9 with DistributedRMICounter

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();
    }
}
Also used : DistributedRMICounter(examples.mvc.rmi.duplex.DistributedRMICounter) LocateRegistry(java.rmi.registry.LocateRegistry) Registry(java.rmi.registry.Registry) ADistributedDelegatingRMICounter(examples.mvc.rmi.duplex.ADistributedDelegatingRMICounter)

Example 10 with DistributedRMICounter

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();
    }
}
Also used : DistributedRMICounter(examples.mvc.rmi.duplex.DistributedRMICounter) ADistributedInheritingRMICounter(examples.mvc.rmi.duplex.ADistributedInheritingRMICounter) LocateRegistry(java.rmi.registry.LocateRegistry) Registry(java.rmi.registry.Registry)

Aggregations

DistributedRMICounter (examples.mvc.rmi.duplex.DistributedRMICounter)11 LocateRegistry (java.rmi.registry.LocateRegistry)8 Registry (java.rmi.registry.Registry)8 ADistributedInheritingRMICounter (examples.mvc.rmi.duplex.ADistributedInheritingRMICounter)4 ADistributedDelegatingRMICounter (examples.mvc.rmi.duplex.ADistributedDelegatingRMICounter)1 GIPCRegistry (inputport.rpc.GIPCRegistry)1 Remote (java.rmi.Remote)1 RemoteException (java.rmi.RemoteException)1