Search in sources :

Example 51 with Registry

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

Example 52 with Registry

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

Example 53 with Registry

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

Example 54 with Registry

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

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();
    }
}
Also used : 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