< prev index next >

src/java.rmi/share/classes/java/rmi/activation/ActivationID.java

Print this page




 208      * <code>ObjectOutput.writeUTF</code>), followed by the
 209      * external form of the <code>RemoteRef</code> instance as
 210      * written by its <code>writeExternal</code> method.
 211      *
 212      * <p>The external ref type name of the
 213      * <code>RemoteRef</Code> instance is
 214      * determined using the definitions of external ref type
 215      * names specified in the {@link java.rmi.server.RemoteObject
 216      * RemoteObject} <code>writeObject</code> method
 217      * <b>serialData</b> specification.  Similarly, the data
 218      * written by the <code>writeExternal</code> method and read
 219      * by the <code>readExternal</code> method of
 220      * <code>RemoteRef</code> implementation classes
 221      * corresponding to each of the defined external ref type
 222      * names is specified in the {@link
 223      * java.rmi.server.RemoteObject RemoteObject}
 224      * <code>writeObject</code> method <b>serialData</b>
 225      * specification.
 226      **/
 227     private void writeObject(ObjectOutputStream out)
 228         throws IOException, ClassNotFoundException
 229     {
 230         out.writeObject(uid);
 231 
 232         RemoteRef ref;
 233         if (activator instanceof RemoteObject) {
 234             ref = ((RemoteObject) activator).getRef();
 235         } else if (Proxy.isProxyClass(activator.getClass())) {
 236             InvocationHandler handler = Proxy.getInvocationHandler(activator);
 237             if (!(handler instanceof RemoteObjectInvocationHandler)) {
 238                 throw new InvalidObjectException(
 239                     "unexpected invocation handler");
 240             }
 241             ref = ((RemoteObjectInvocationHandler) handler).getRef();
 242 
 243         } else {
 244             throw new InvalidObjectException("unexpected activator type");
 245         }
 246         out.writeUTF(ref.getRefClass(out));
 247         ref.writeExternal(out);
 248     }




 208      * <code>ObjectOutput.writeUTF</code>), followed by the
 209      * external form of the <code>RemoteRef</code> instance as
 210      * written by its <code>writeExternal</code> method.
 211      *
 212      * <p>The external ref type name of the
 213      * <code>RemoteRef</Code> instance is
 214      * determined using the definitions of external ref type
 215      * names specified in the {@link java.rmi.server.RemoteObject
 216      * RemoteObject} <code>writeObject</code> method
 217      * <b>serialData</b> specification.  Similarly, the data
 218      * written by the <code>writeExternal</code> method and read
 219      * by the <code>readExternal</code> method of
 220      * <code>RemoteRef</code> implementation classes
 221      * corresponding to each of the defined external ref type
 222      * names is specified in the {@link
 223      * java.rmi.server.RemoteObject RemoteObject}
 224      * <code>writeObject</code> method <b>serialData</b>
 225      * specification.
 226      **/
 227     private void writeObject(ObjectOutputStream out)
 228         throws IOException
 229     {
 230         out.writeObject(uid);
 231 
 232         RemoteRef ref;
 233         if (activator instanceof RemoteObject) {
 234             ref = ((RemoteObject) activator).getRef();
 235         } else if (Proxy.isProxyClass(activator.getClass())) {
 236             InvocationHandler handler = Proxy.getInvocationHandler(activator);
 237             if (!(handler instanceof RemoteObjectInvocationHandler)) {
 238                 throw new InvalidObjectException(
 239                     "unexpected invocation handler");
 240             }
 241             ref = ((RemoteObjectInvocationHandler) handler).getRef();
 242 
 243         } else {
 244             throw new InvalidObjectException("unexpected activator type");
 245         }
 246         out.writeUTF(ref.getRefClass(out));
 247         ref.writeExternal(out);
 248     }


< prev index next >