< prev index next >

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

Print this page




 255      * implementation-specific class must be found, and its
 256      * <code>readExternal</code> method must read the serial data
 257      * for that external ref type name as specified to be written
 258      * in the <b>serialData</b> documentation for this class.
 259      * If the external ref type name is any other string (of non-zero
 260      * length), a <code>ClassNotFoundException</code> will be thrown,
 261      * unless the implementation provides an implementation-specific
 262      * class corresponding to that external ref type name, in which
 263      * case the <code>RemoteRef</code> will be an instance of
 264      * that implementation-specific class.
 265      */
 266     private void readObject(ObjectInputStream in)
 267         throws IOException, ClassNotFoundException
 268     {
 269         uid = (UID)in.readObject();
 270 
 271         try {
 272             Class<? extends RemoteRef> refClass =
 273                 Class.forName(RemoteRef.packagePrefix + "." + in.readUTF())
 274                 .asSubclass(RemoteRef.class);

 275             RemoteRef ref = refClass.newInstance();
 276             ref.readExternal(in);
 277             activator = (Activator)
 278                 Proxy.newProxyInstance(Activator.class.getClassLoader(),
 279                                        new Class<?>[] { Activator.class },
 280                                        new RemoteObjectInvocationHandler(ref));
 281         } catch (InstantiationException e) {
 282             throw (IOException)
 283                 new InvalidObjectException(
 284                     "Unable to create remote reference").initCause(e);
 285         } catch (IllegalAccessException e) {
 286             throw (IOException)
 287                 new InvalidObjectException(
 288                     "Unable to create remote reference").initCause(e);
 289         }
 290     }
 291 }


 255      * implementation-specific class must be found, and its
 256      * <code>readExternal</code> method must read the serial data
 257      * for that external ref type name as specified to be written
 258      * in the <b>serialData</b> documentation for this class.
 259      * If the external ref type name is any other string (of non-zero
 260      * length), a <code>ClassNotFoundException</code> will be thrown,
 261      * unless the implementation provides an implementation-specific
 262      * class corresponding to that external ref type name, in which
 263      * case the <code>RemoteRef</code> will be an instance of
 264      * that implementation-specific class.
 265      */
 266     private void readObject(ObjectInputStream in)
 267         throws IOException, ClassNotFoundException
 268     {
 269         uid = (UID)in.readObject();
 270 
 271         try {
 272             Class<? extends RemoteRef> refClass =
 273                 Class.forName(RemoteRef.packagePrefix + "." + in.readUTF())
 274                 .asSubclass(RemoteRef.class);
 275             @SuppressWarnings("deprecation")
 276             RemoteRef ref = refClass.newInstance();
 277             ref.readExternal(in);
 278             activator = (Activator)
 279                 Proxy.newProxyInstance(Activator.class.getClassLoader(),
 280                                        new Class<?>[] { Activator.class },
 281                                        new RemoteObjectInvocationHandler(ref));
 282         } catch (InstantiationException e) {
 283             throw (IOException)
 284                 new InvalidObjectException(
 285                     "Unable to create remote reference").initCause(e);
 286         } catch (IllegalAccessException e) {
 287             throw (IOException)
 288                 new InvalidObjectException(
 289                     "Unable to create remote reference").initCause(e);
 290         }
 291     }
 292 }
< prev index next >