home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VPage / Java.bin / CLASSES.ZIP / sun / rmi / transport / proxy / AsyncConnector.class (.txt) next >
Encoding:
Java Class File  |  1997-07-08  |  1.6 KB  |  82 lines

  1. package sun.rmi.transport.proxy;
  2.  
  3. import java.io.IOException;
  4. import java.net.Socket;
  5. import java.rmi.server.RMISocketFactory;
  6.  
  7. class AsyncConnector implements Runnable {
  8.    protected RMIMasterSocketFactory master;
  9.    protected RMISocketFactory factory;
  10.    protected String host;
  11.    protected int port;
  12.    protected IOException exception;
  13.    protected Socket socket;
  14.    boolean cleanUp = false;
  15.  
  16.    AsyncConnector(RMIMasterSocketFactory var1, RMISocketFactory var2, String var3, int var4) {
  17.       this.master = var1;
  18.       this.factory = var2;
  19.       this.host = var3;
  20.       this.port = var4;
  21.    }
  22.  
  23.    public void run() {
  24.       try {
  25.          Socket var23 = this.factory.createSocket(this.host, this.port);
  26.          synchronized(this){}
  27.  
  28.          try {
  29.             this.socket = var23;
  30.             this.notify();
  31.          } catch (Throwable var20) {
  32.             throw var20;
  33.          }
  34.  
  35.          this.master.rememberFactory(this.host, this.factory);
  36.          synchronized(this){}
  37.  
  38.          try {
  39.             if (this.cleanUp) {
  40.                try {
  41.                   this.socket.close();
  42.                } catch (IOException var19) {
  43.                }
  44.             }
  45.          } catch (Throwable var21) {
  46.             throw var21;
  47.          }
  48.  
  49.       } catch (IOException var22) {
  50.          IOException var1 = var22;
  51.          synchronized(this){}
  52.  
  53.          try {
  54.             this.exception = var1;
  55.             this.notify();
  56.          } catch (Throwable var18) {
  57.             throw var18;
  58.          }
  59.  
  60.       }
  61.    }
  62.  
  63.    synchronized IOException getException() {
  64.       return this.exception;
  65.    }
  66.  
  67.    synchronized Socket getSocket() {
  68.       return this.socket;
  69.    }
  70.  
  71.    synchronized void notUsed() {
  72.       if (this.socket != null) {
  73.          try {
  74.             this.socket.close();
  75.          } catch (IOException var1) {
  76.          }
  77.       }
  78.  
  79.       this.cleanUp = true;
  80.    }
  81. }
  82.