title: Using Java RMI, when exactly is the serialized object transmitted over the network?
body: <p>I am using RMI to implement some distributed algorithm, and since we're transmitting quite big objects, I'd like some precisions about when RMI transmits serialized objects over the network.</p>
  
  <p>Suppose I have a Remote classe with the following method.</p>
  
  <pre><code>class MyServer extends Remote {
      public synchronized void foo (Bar bar) {
          ...
          Thread.wait();
          ...
      }
  }
  </code></pre>
  
  <p>Now, I have two (or more) RMI clients calling MyServer.foo method.
  When <strong>Client 1</strong> calls it, it gets blocked in <em>Thread.wait()</em>. Then, <strong>Client 2</strong> calls <em>foo</em> and it gets blocked because Client 1 is still in the <em>foo</em> method which is synchronized.</p>
  
  <p>Now, the question is : When is the <em>bar</em> parameter of the <strong>Client 2</strong> call transmitted over the network ? Only once <strong>Client 2</strong> can actually enter the <em>foo</em> method or before, when it is blocked ?</p>
  
  <p>Bonus question : Is this (the time at which objects are transmitted) a behavior that is enforced by RMI specs or is this implementation-specific ?</p>