1 21 22 package com.izforge.izpack.util; 23 24 import java.util.Vector ; 25 26 27 40 41 public class Housekeeper 42 { 43 44 private static Housekeeper me = null; 48 49 private Vector cleanupClients = new Vector (); 50 51 52 60 61 private Housekeeper() 62 { 63 } 64 65 66 71 72 public static Housekeeper getInstance() 73 { 74 if (me == null) 75 { 76 me = new Housekeeper(); 77 } 78 79 return (me); 80 } 81 82 83 89 90 public void registerForCleanup(CleanupClient client) 91 { 92 cleanupClients.add(client); 93 } 94 95 96 105 106 public void shutDown(int exitCode) 107 { 108 for (int i = 0; i < cleanupClients.size(); i++) 109 { 110 try 111 { 112 ((CleanupClient) cleanupClients.elementAt(i)).cleanUp(); 113 } 114 catch (Throwable exception) 115 { 116 } 124 } 125 126 System.exit(exitCode); 127 } 128 } 129 130 | Popular Tags |