Java Code Examples for java.rmi.server.RemoteRef#writeExternal()
The following examples show how to use
java.rmi.server.RemoteRef#writeExternal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActivatableRef.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Write out external representation for remote ref. */ public void writeExternal(ObjectOutput out) throws IOException { RemoteRef localRef = ref; out.writeObject(id); if (localRef == null) { out.writeUTF(""); } else { out.writeUTF(localRef.getRefClass(out)); localRef.writeExternal(out); } }
Example 2
Source File: ActivatableRef.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Write out external representation for remote ref. */ public void writeExternal(ObjectOutput out) throws IOException { RemoteRef localRef = ref; out.writeObject(id); if (localRef == null) { out.writeUTF(""); } else { out.writeUTF(localRef.getRefClass(out)); localRef.writeExternal(out); } }
Example 3
Source File: ActivatableRef.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Write out external representation for remote ref. */ public void writeExternal(ObjectOutput out) throws IOException { RemoteRef localRef = ref; out.writeObject(id); if (localRef == null) { out.writeUTF(""); } else { out.writeUTF(localRef.getRefClass(out)); localRef.writeExternal(out); } }
Example 4
Source File: ActivatableRef.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Write out external representation for remote ref. */ public void writeExternal(ObjectOutput out) throws IOException { RemoteRef localRef = ref; out.writeObject(id); if (localRef == null) { out.writeUTF(""); } else { out.writeUTF(localRef.getRefClass(out)); localRef.writeExternal(out); } }
Example 5
Source File: ActivatableRef.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Write out external representation for remote ref. */ public void writeExternal(ObjectOutput out) throws IOException { RemoteRef localRef = ref; out.writeObject(id); if (localRef == null) { out.writeUTF(""); } else { out.writeUTF(localRef.getRefClass(out)); localRef.writeExternal(out); } }
Example 6
Source File: ActivatableRef.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Write out external representation for remote ref. */ public void writeExternal(ObjectOutput out) throws IOException { RemoteRef localRef = ref; out.writeObject(id); if (localRef == null) { out.writeUTF(""); } else { out.writeUTF(localRef.getRefClass(out)); localRef.writeExternal(out); } }
Example 7
Source File: ActivatableRef.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Write out external representation for remote ref. */ public void writeExternal(ObjectOutput out) throws IOException { RemoteRef localRef = ref; out.writeObject(id); if (localRef == null) { out.writeUTF(""); } else { out.writeUTF(localRef.getRefClass(out)); localRef.writeExternal(out); } }
Example 8
Source File: ActivatableRef.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Write out external representation for remote ref. */ public void writeExternal(ObjectOutput out) throws IOException { RemoteRef localRef = ref; out.writeObject(id); if (localRef == null) { out.writeUTF(""); } else { out.writeUTF(localRef.getRefClass(out)); localRef.writeExternal(out); } }
Example 9
Source File: ActivatableRef.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Write out external representation for remote ref. */ public void writeExternal(ObjectOutput out) throws IOException { RemoteRef localRef = ref; out.writeObject(id); if (localRef == null) { out.writeUTF(""); } else { out.writeUTF(localRef.getRefClass(out)); localRef.writeExternal(out); } }
Example 10
Source File: ActivationID.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }
Example 11
Source File: ActivationID.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }
Example 12
Source File: ActivationID.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }
Example 13
Source File: ActivationID.java From Java8CN with Apache License 2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }
Example 14
Source File: ActivationID.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }
Example 15
Source File: ActivationID.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }
Example 16
Source File: ActivationID.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }
Example 17
Source File: ActivationID.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }
Example 18
Source File: ActivationID.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }
Example 19
Source File: ActivationID.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }
Example 20
Source File: ActivationID.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }