home *** CD-ROM | disk | FTP | other *** search
- package java.rmi.server;
-
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.io.Serializable;
- import java.rmi.MarshalException;
- import java.rmi.Remote;
- import java.rmi.UnmarshalException;
-
- public abstract class RemoteObject implements Remote, Serializable {
- protected transient RemoteRef ref;
-
- protected RemoteObject() {
- this.ref = null;
- }
-
- protected RemoteObject(RemoteRef var1) {
- this.ref = var1;
- }
-
- public int hashCode() {
- return this.ref == null ? super.hashCode() : this.ref.remoteHashCode();
- }
-
- public boolean equals(Object var1) {
- if (var1 instanceof RemoteObject) {
- if (this.ref == null) {
- return var1 == this;
- } else {
- return this.ref.remoteEquals(((RemoteObject)var1).ref);
- }
- } else {
- return var1 != null ? var1.equals(this) : false;
- }
- }
-
- public String toString() {
- String var1 = this.getClass().getName();
- return this.ref == null ? var1 : var1 + "[" + this.ref.remoteToString() + "]";
- }
-
- private void writeObject(ObjectOutputStream var1) throws IOException, ClassNotFoundException {
- if (this.ref == null) {
- throw new MarshalException("Invalid remote object");
- } else {
- var1.writeUTF(this.ref.getRefClass(var1));
- this.ref.writeExternal(var1);
- }
- }
-
- private void readObject(ObjectInputStream var1) throws IOException, ClassNotFoundException {
- try {
- Class var2 = Class.forName(RemoteRef.packagePrefix + "." + var1.readUTF());
- this.ref = (RemoteRef)var2.newInstance();
- this.ref.readExternal(var1);
- } catch (InstantiationException var3) {
- throw new UnmarshalException("Unable to create remote reference", var3);
- } catch (IllegalAccessException var4) {
- throw new UnmarshalException("Illegal access creating remote reference");
- }
- }
- }
-