Figure 11: The timer bean's init method
// used to start up a timer public synchronized void init() { if (firstTime) { runner.start(); firstTime = false; } setSuspended(false); } // Causes the thread to fall out of the // bottom of the run method, thereby // terminating the thread public synchronized void destroy() { running = false; } // The heart of the thread public void run() { while (running) { checkIfSuspended(); try { Thread.sleep(theInterval); theCount++; notifyFired(); } catch(InterruptedException e) { System.out.println(e); } }