Figure 4: Methods to add and remove subscribers to the timer bean's events

public synchronized void 
addTimerListener(TimerListener l) {
   if (!listeners.contains(l)) {
      listeners.addElement(l); 
   }
}

public synchronized void 
removeTimerListener(TimerListener l) {
   if (listeners.contains(l)) {        
      listeners.removeElement(l); 
   }
}