public synchronized void addListener(Object listener){
  if (listener != null) {
    if (listeners == null) {
      listeners=new ArrayList<Object>();
    }
    if (!listeners.contains(listener)) {
      listeners.add(listener);
    }
  }
}

public synchronized void addListener ( Object listener ) { if ( listener != null ) { if ( listeners == null ) { listeners = new ArrayList < Object > ( ) ; } if ( ! listeners . contains ( listener ) ) { listeners . add ( listener ) ; } } }
add a listener to the dispatcher that would receive the events when they occurs
