home *** CD-ROM | disk | FTP | other *** search
/ Australian PC Authority 1999 May / may1999.iso / INTERNET / COMMUNIC / NETCAST.Z / marimb10.jar / netscape / netcast / ThreadGroupStopper.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-25  |  1.7 KB  |  36 lines

  1. package netscape.netcast;
  2.  
  3. import marimba.castanet.client.CastanetConstants;
  4. import marimba.castanet.client.CastanetWorkspace;
  5.  
  6. class ThreadGroupStopper implements Runnable, CastanetConstants {
  7.    ApplicationThreadGroup group;
  8.  
  9.    ThreadGroupStopper(CastanetWorkspace ws, ApplicationThreadGroup group) {
  10.       this.group = group;
  11.       ws.addLocalTask(this, "Destroy-" + ((ThreadGroup)group).getName(), 8);
  12.    }
  13.  
  14.    public void run() {
  15.       try {
  16.          for(int i = 0; i < 3; ++i) {
  17.             this.group.close();
  18.  
  19.             try {
  20.                Thread.sleep(250L);
  21.             } catch (InterruptedException var7) {
  22.             }
  23.  
  24.             try {
  25.                this.group.destroy();
  26.                break;
  27.             }
  28.          }
  29.       } finally {
  30.          this.group = null;
  31.          Runtime.getRuntime().gc();
  32.       }
  33.  
  34.    }
  35. }
  36.