home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / java / rmi / server / UnicastRemoteObject.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  1.9 KB  |  46 lines

  1. package java.rmi.server;
  2.  
  3. import java.io.IOException;
  4. import java.io.ObjectInputStream;
  5. import java.rmi.Remote;
  6. import java.rmi.RemoteException;
  7.  
  8. public class UnicastRemoteObject extends RemoteServer {
  9.    protected UnicastRemoteObject() throws RemoteException {
  10.       exportObject(this);
  11.    }
  12.  
  13.    private void readObject(ObjectInputStream var1) throws IOException, ClassNotFoundException {
  14.       exportObject(this);
  15.    }
  16.  
  17.    public Object clone() throws CloneNotSupportedException {
  18.       try {
  19.          UnicastRemoteObject var1 = (UnicastRemoteObject)super.clone();
  20.          exportObject(var1);
  21.          return var1;
  22.       } catch (RemoteException var2) {
  23.          throw new ServerCloneException("Clone failed", var2);
  24.       }
  25.    }
  26.  
  27.    public static RemoteStub exportObject(Remote var0) throws RemoteException {
  28.       try {
  29.          Class var1 = Class.forName(RemoteRef.packagePrefix + ".UnicastServerRef");
  30.          Object var2 = var1.newInstance();
  31.          if (var2 instanceof ServerRef) {
  32.             ServerRef var3 = (ServerRef)var2;
  33.             if (var0 instanceof UnicastRemoteObject) {
  34.                ((UnicastRemoteObject)var0).ref = var3;
  35.             }
  36.  
  37.             return var3.exportObject(var0, (Object)null);
  38.          } else {
  39.             throw new ExportException("Reference is not a java.rmi.server.ServerRef");
  40.          }
  41.       } catch (Exception var4) {
  42.          throw new ExportException("Unable to create remote reference", var4);
  43.       }
  44.    }
  45. }
  46.