title: Remote Method Invocation(RMI) - how the server knows what the client invoked?
body: <p>I have a program in which there are these classes:
  <br>RMIServer,
  <br>RMIClient,
  <br>RMIImplementation,
  <br>RMIInterface</p>
  
  <p>which are as follows: </p>
  
  <p>RMIServer:</p>
  
  <pre><code>public static void main ( String args[] ) throws Exception
  {
    System.out.println( "RMI Server started" ) ;
  
    String codebase = "http://localhost:8080/rmi/" ; 
    String name     = "RMIInterface"               ;
  
    System.setProperty ( "java.rmi.server.codebase" , codebase  ) ;
  
    RMIImplementation obj  = new RMIImplementation()                                    ;
    RMIInterface      stub = (RMIInterface) UnicastRemoteObject.exportObject( obj , 0 ) ;
  
    LocateRegistry.getRegistry().bind( name , stub ) ;
  
    System.out.println( "Done!" ) ;
  
  }  
  </code></pre>
  
  <p>RMIClient:</p>
  
  <pre><code>public static void main ( String args[] ) throws Exception
  {
      String host = "localhost"    ;
      String name = "RMIInterface" ;
  
  
      Registry     registry = LocateRegistry.getRegistry( host )     ;
      RMIInterface i        = (RMIInterface) registry.lookup( name ) ;
  
      System.out.println("RMI service call result:");
      for(Candidate c : list){
          if(c.status == Candidate.Eligibility.ELIGIBLE ){
              System.out.println( "  Issued a license to " + i.issueLicense(c.name, c.age) ) ;   
          }
      } 
  
      System.out.println( "License Server finished" ) ;
  }
  </code></pre>
  
  <p>RMIInterface:</p>
  
  <pre><code>public interface RMIInterface extends Remote
  {
    String issueLicense ( String name , int age ) throws RemoteException ;
  }
  </code></pre>
  
  <p>RMIImplementation:</p>
  
  <pre><code>public class RMIImplementation implements RMIInterface {
  
      public RMIImplementation() {
          System.out.println("RMIImplementation instance created and ready to serve");
      }
  
      @Override
      public String issueLicense(String name, int age) {
          return name + " (" + age + ")";
      }
  }
  </code></pre>
  
  <p>(This program is for a test purpose. The test is done in one machine.)</p>
  
  <p>Well, the client makes calls to the remote object, sending some parameters.</p>
  
  <p>I want the RMIServer to print out the summary of the calls made from the client to the remote object. What should I do to have access to such information?</p>
  
  <p>I want the output to look like this:</p>
  
  <pre><code>RMI Server started
  RMIImplementation instance created and ready to serve
  RMI service called for : 
    tonny (30)
    john (26)
  </code></pre>