Search in sources :

Example 1 with ADistributedInheritingRMICounter

use of examples.mvc.rmi.duplex.ADistributedInheritingRMICounter in project GIPC by pdewan.

the class ACounterSessionMember method init.

protected static void init(String aMyName, int aPortNumber) {
    gipcRegistry = GIPCLocateSessionRegistry.createOrGetSessionRegistry("mysession", "localhost", aPortNumber, aMyName, sessionChoice, numMembersToWaitFor);
    counter = new ADistributedInheritingRMICounter();
    gipcRegistry.rebind(COUNTER_NAME, counter);
    groupRPCSessionPort = gipcRegistry.getSessionPort();
}
Also used : ADistributedInheritingRMICounter(examples.mvc.rmi.duplex.ADistributedInheritingRMICounter)

Example 2 with ADistributedInheritingRMICounter

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

Example 3 with ADistributedInheritingRMICounter

use of examples.mvc.rmi.duplex.ADistributedInheritingRMICounter 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 4 with ADistributedInheritingRMICounter

use of examples.mvc.rmi.duplex.ADistributedInheritingRMICounter 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 5 with ADistributedInheritingRMICounter

use of examples.mvc.rmi.duplex.ADistributedInheritingRMICounter 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

ADistributedInheritingRMICounter (examples.mvc.rmi.duplex.ADistributedInheritingRMICounter)6 DistributedRMICounter (examples.mvc.rmi.duplex.DistributedRMICounter)4 LocateRegistry (java.rmi.registry.LocateRegistry)3 Registry (java.rmi.registry.Registry)3 GIPCRegistry (inputport.rpc.GIPCRegistry)1 Remote (java.rmi.Remote)1 ATracingConnectionListener (port.ATracingConnectionListener)1