title: RMI how to test whether an object is exported
body: <p>How can I test whether an object is already exported? I migrate objects from host to host. Before I copy an object (with its state) to another node, I have to unexport the object with <code>UnicastRemoteObject.unexportObject(this, true)</code>, but this method throws a <code>java.rmi.NoSuchObjectException: object not exported</code> if the object has not yet been exported. </p>
  
  <p>What I am looking for is a method to test whether an object is already exported (without catching an exception and without unexporting the object). With respect to the result, the test should have the same behavior as the following method:</p>
  
  <pre><code>boolean isExported(Object x) {
      boolean result = false;
      try {
          UnicastRemoteObject.unexportObject(this, true);
          result = true;
          UnicastRemoteObject.exportObject(this, 0);
      } catch (Exception e) {
      }
      return result;
  }
  </code></pre>
  
  <p>Thanks for your help.</p>