RMI - Invocacoes do Client

Pessoal,

Como altero no codigo abaixo para que o Cliente fique esperando as mensagens que serao enviadas em loop.
Segue o codigo.

public class RmiClient
{
    static public void main(String args[])
    {
       ReceiveMessageInterface rmiServer;
       Registry registry;
       String serverAddress=args[0];
       String serverPort=args[1];
       String text=args[2];
       System.out.println("sending "+text+" to "+serverAddress+":"+serverPort);
       try{
           // get the ?registry? 
           registry=LocateRegistry.getRegistry(
               serverAddress,
               (new Integer(serverPort)).intValue()
           );
           // look up the remote object
           rmiServer=
              (ReceiveMessageInterface)(registry.lookup("rmiServer"));
           // call the remote method
           rmiServer.receiveMessage(text);
       }       
       
       catch(RemoteException e){
           e.printStackTrace();
       }
       catch(NotBoundException e){
           e.printStackTrace();
       }
    }
}

Valeu.

[size=“11”][color=“red”]* Editado: Lembre-se de utilizar BBCode em seus códigos - Matheus [/color][/size] :joia:

Com threads :slight_smile: