< prev index next >

src/java.rmi/share/classes/java/rmi/server/RemoteObject.java

Print this page




  77      * of its <code>RemoteObject</code> wrapper instance or the result may
  78      * be unportable.
  79      *
  80      * @return remote reference for the remote object
  81      * @since 1.2
  82      */
  83     public RemoteRef getRef() {
  84         return ref;
  85     }
  86 
  87     /**
  88      * Returns the stub for the remote object <code>obj</code> passed
  89      * as a parameter. This operation is only valid <i>after</i>
  90      * the object has been exported.
  91      * @param obj the remote object whose stub is needed
  92      * @return the stub for the remote object, <code>obj</code>.
  93      * @exception NoSuchObjectException if the stub for the
  94      * remote object could not be found.
  95      * @since 1.2
  96      */

  97     public static Remote toStub(Remote obj) throws NoSuchObjectException {
  98         if (obj instanceof RemoteStub ||
  99             (obj != null &&
 100              Proxy.isProxyClass(obj.getClass()) &&
 101              Proxy.getInvocationHandler(obj) instanceof
 102              RemoteObjectInvocationHandler))
 103         {
 104             return obj;
 105         } else {
 106             return sun.rmi.transport.ObjectTable.getStub(obj);
 107         }
 108     }
 109 
 110     /**
 111      * Returns a hashcode for a remote object.  Two remote object stubs
 112      * that refer to the same remote object will have the same hash code
 113      * (in order to support remote objects as keys in hash tables).
 114      *
 115      * @see             java.util.Hashtable
 116      */




  77      * of its <code>RemoteObject</code> wrapper instance or the result may
  78      * be unportable.
  79      *
  80      * @return remote reference for the remote object
  81      * @since 1.2
  82      */
  83     public RemoteRef getRef() {
  84         return ref;
  85     }
  86 
  87     /**
  88      * Returns the stub for the remote object <code>obj</code> passed
  89      * as a parameter. This operation is only valid <i>after</i>
  90      * the object has been exported.
  91      * @param obj the remote object whose stub is needed
  92      * @return the stub for the remote object, <code>obj</code>.
  93      * @exception NoSuchObjectException if the stub for the
  94      * remote object could not be found.
  95      * @since 1.2
  96      */
  97     @SuppressWarnings("deprecation")
  98     public static Remote toStub(Remote obj) throws NoSuchObjectException {
  99         if (obj instanceof RemoteStub ||
 100             (obj != null &&
 101              Proxy.isProxyClass(obj.getClass()) &&
 102              Proxy.getInvocationHandler(obj) instanceof
 103              RemoteObjectInvocationHandler))
 104         {
 105             return obj;
 106         } else {
 107             return sun.rmi.transport.ObjectTable.getStub(obj);
 108         }
 109     }
 110 
 111     /**
 112      * Returns a hashcode for a remote object.  Two remote object stubs
 113      * that refer to the same remote object will have the same hash code
 114      * (in order to support remote objects as keys in hash tables).
 115      *
 116      * @see             java.util.Hashtable
 117      */


< prev index next >