9 Replies Latest reply: Sep 30, 2010 1:42 AM by 800745 RSS

    Remote Registy & Logical Port Exhaustion with multiple JVMs

    800745
      Hi

      With reference to below links:

      http://forums.sun.com/thread.jspa?threadID=5448277&messageID=11042211#11042211

      http://forums.sun.com/thread.jspa?threadID=5450445&messageID=11050066#11050066

      Will I have a solution with CORBA? (What is the correct Forum Link)

      When you have multiple clients getting registered with server for client call backs the actual JVM is running on the Server and not on the Client am I correct?

      Edited by: EJP on 28/09/2010 17:09
        • 1. Re: Remote Registy & Logical Port Exhortation with multiple JVMs
          EJP
          I have no idea what your are asking here, starting with your title. 'Exhortation' has nothing to do with RMI, Java, TCP/IP, or computers. The threads you cited cover four or five different topics. Please state your question specifically.
          • 2. Re: Remote Registy & Logical Port Exhortation with multiple JVMs
            800745
            Hi,

            I did an experiment with following setup.

            1 Registrar : Binds Remote Objects on to the RMI Registry / Gets and Instance passed as a Parameter to registry and exports it and then Binds it in the local registry. / This will help Clients to Look up for Server remote Obj and Slaves to Look up Clients Remote Obj
            1 Server :Look up for Registrar Remote Object and get registers with Registrar / Instruct Clients to generate Integers in parallel
            10 Clients : Look up for Registrar Remote Object and get registers with Registrar / Integer generators / Reports to Server when respective 3 clients have reported fully
            30 Slaves : Reports to Clients (3 Slaves Per Client) perform most computations.

            Execution :

            1. Start Registrar and Server on 10.0.0.183
            2. Manually starting clients on 5 nodes 10.0.0.178 ~ 182 : Will look up the registry on 10.0.0.183 and register will bind Client Object in the RMI registry
            3. Manually starting slaves on 15 nodes
            4. Once slaves get registered with respective client, client will report to server.
            5. server will wait for 10 clients to report.
            6. Then server will start the execution process.

            Result :

            Program runs for few cycles and stops (4 to 5). (It should run for 10000 cycles)

            Assumption:

            Having a Single Registry and Multiple clients looking up the remote object would lead to port exhortation?

            In my opinion, even though I run the applications in multiple machines once remote objects get registered with the Registrar the actual JVM that performs the execution could be residing in one machine.


            CODE SAMPLES :

            Class Registra

            // Gets a Server instance and exports it
            // Binds the stub of exported Obj to local registry
            public void registra(ART_Interface server) throws RemoteException{

            if (System.getSecurityManager() == null) {
            System.setSecurityManager(new SecurityManager());
            }

            try {
            serverInstance = (ART_Interface) UnicastRemoteObject.exportObject(server, 0);
            Registry registry = LocateRegistry.getRegistry();
            registry.rebind("Server_Obj", serverInstance);
            System.out.println("Server Reported to Registra");

            } catch (Exception e) {
            System.out.println("Server Registration: Error: "+e);
            }
            }

            // Gets a Client instance and exports it
            // Binds the stub of exported Obj to local registry
            public void registra(Client_Interface clients, int iClientID) throws RemoteException{

            clientInstance = clients;

            if (System.getSecurityManager() == null) {
            System.setSecurityManager(new SecurityManager());
            }

            try {
            clientInstance = (Client_Interface) UnicastRemoteObject.exportObject(clients, 0);
            Registry registry = LocateRegistry.getRegistry();
            registry.rebind("Client_Obj" + iClientID, clientInstance);
            System.out.println("Client [" + iClientID + "] Reported to Registra");

            } catch (Exception e) {
            System.out.println("Client Registration: Error: "+e);
            }
            }


            Class Server

            // Server Main Method
            public static void main(String[] args) {
            if (args.length < 3) {
            System.out.println("Usage ART_SERVER <HOST> <CLIENTS> <CYCLES>");
            System.exit(0);
            }
            // Command Arguments : <HOST> <CLIENTS> <CYCLES>
            String o_Host1 = args[0];
            int iClients = Integer.parseInt(args[1]);
            int iCycles = Integer.parseInt(args[2]);

            // Server Instance
            ART_Server oServer = new ART_Server(iClients, iCycles, o_Host1);

            try {
            //Exporting Server Obj
            UnicastRemoteObject.exportObject(oServer, 0);
            System.out.println("Server Object Exported");

            //Look Up for Registrar Remote Object and pass server instance to get registered
            Registry registry = LocateRegistry.getRegistry(oServer.o_RegistryReference);
            Registry_Interface registra = (Registry_Interface) registry.lookup("Registra");
            registra.registra(oServer);
            System.out.println("Server Object Registering");

            } catch (Exception e) {
            System.out.println("Server Registration Failed, Error: " + e);
            }
            }
            • 3. Re: Remote Registy & Logical Port Exhortation with multiple JVMs
              EJP
              and exports it
              You don't need to do that; in fact, exporting a stub would fail, I would have thought. If it succeeds, you're interposing the JVM you exported it from into the communications chain, which seems pointless, and probably not what you intended.
              This will help Clients to Look up for Server remote Obj and Slaves to Look up Clients Remote Obj
              But why can't the clients look up the server's Registry? and why can't the slaves look up the client's registry?
              Assumption:

              Having a Single Registry and Multiple clients looking up the remote object would lead to port exhortation?
              I still* don't know what you mean by 'port exhortation'. Do you mean +'exhaustion'+ by any chance? Please communicate clearly.
              In my opinion, even though I run the applications in multiple machines once remote objects get registered with the Registrar the actual JVM that performs the execution could be residing in one machine.
              I do not understand this statement. Please communicate clearly.
              if (System.getSecurityManager() == null) {
              System.setSecurityManager(new SecurityManager());
              Why do you keep repeating this everywhere? Do it once at startup.
              serverInstance = (ART_Interface) UnicastRemoteObject.exportObject(server, 0);
              clientInstance = (Client_Interface) UnicastRemoteObject.exportObject(clients, 0);
              I don't understand this. Where did 'server' and 'clients' come from? If you got them from another registry they are already exported. If they are locally constructed objects that extends UnicastRemoteObject, they are already exported. Why are you doing that again?
              UnicastRemoteObject.exportObject(oServer, 0);
              See? It's already exported.
              • 4. Re: Remote Registy & Logical Port Exhortation with multiple JVMs
                800745
                I still don't know what you mean by 'port exhortation'. Do you mean 'exhaustion' by any chance? Please communicate clearly.
                Sorry I meant exhaustion
                I do not understand this statement. Please communicate clearly.
                When I have 10 clients that is registering with server for call backs and when I am doing invocations from server on methods in client on which JVM that the execution take place (Server in one machine and Clients are running on several different machines)
                I don't understand this. Where did 'server' and 'clients' come from? If you got them from another registry they are already exported. If they are locally constructed objects that extends UnicastRemoteObject, they are already exported. Why are you doing that again?
                So you mean if I export an object and passes it to server for call backs. and In return if I want to bind that exported object in server's registry I do no need to re-export it?


                Can you help me with finding an example on multiple clients registering to server and concurrent call backs to client by server.?
                • 5. Re: Remote Registy & Logical Port Exhortation with multiple JVMs
                  EJP
                  on which JVM that the execution take place
                  All the rest of that question is irrelevant. Execution takes place in the JVM the object was exported from.
                  So you mean if I export an object and passes it to server for call backs. and In return if I want to bind that exported object in server's registry I do no need to re-export it?
                  Correct.
                  • 6. Re: Remote Registy & Logical Port Exhortation with multiple JVMs
                    800745
                    Brilliant!!

                    So that is why the ports where exhaustion taking place as I have been re exporting them in the Registra Class resulting in program to stall.

                    In this case I could keep my program as it is and execute them without re-exporting server and Client objects in Registrar.
                    • 7. Re: Remote Registy & Logical Port Exhortation with multiple JVMs
                      800745
                      One more thing:

                      If I export and object instance of a client in machine "A" and passes the instance to server which is running on Machine "B" for call backs. Then if I get the server to bind the instance received from client in server's registry.... Would it allow me to do so?

                      Regards,

                      Mark,
                      • 8. Re: Remote Registy & Logical Port Exhortation with multiple JVMs
                        EJP
                        If I export and object instance of a client in machine "A" and passes the instance to server which is running on Machine "B" for call backs. Then if I get the server to bind the instance received from client in server's registry.... Would it allow me to do so?
                        Sure. You can bind any remote reference into your local Registry.