Search in sources :

Example 46 with Registry

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();
    }
}
Also used : Scanner(java.util.Scanner) LocateRegistry(java.rmi.registry.LocateRegistry) Registry(java.rmi.registry.Registry)

Example 47 with Registry

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

Example 48 with Registry

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

Example 49 with Registry

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();
    }
}
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 50 with Registry

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

Aggregations

Registry (java.rmi.registry.Registry)128 LocateRegistry (java.rmi.registry.LocateRegistry)119 RemoteException (java.rmi.RemoteException)43 IOException (java.io.IOException)20 Remote (java.rmi.Remote)16 NodeRegisterRMIStub (org.mobicents.tools.sip.balancer.NodeRegisterRMIStub)14 UnknownHostException (java.net.UnknownHostException)13 JMXServiceURL (javax.management.remote.JMXServiceURL)12 HashMap (java.util.HashMap)10 NotBoundException (java.rmi.NotBoundException)9 JMXConnector (javax.management.remote.JMXConnector)9 DistributedRMICounter (examples.mvc.rmi.duplex.DistributedRMICounter)8 SocketException (java.net.SocketException)8 AlreadyBoundException (java.rmi.AlreadyBoundException)8 MBeanServerConnection (javax.management.MBeanServerConnection)8 JMXConnectorServer (javax.management.remote.JMXConnectorServer)8 Test (org.junit.Test)8 MBeanServer (javax.management.MBeanServer)7 InetAddress (java.net.InetAddress)6 MalformedURLException (java.net.MalformedURLException)6