public synchronized boolean add(Object listener) {
        if (listener==null) {
            //TODO add a log message to help developers know they are 
            //probably doing something wrong
            return false;
        }
        if (listenerArray == NULL_ARRAY) {
            // if this is the first listener added, 
            // initialize the lists
            listenerArray = new Object[] {listener};
        } else {
            //check to not add twice same listener 
            for (int i = listenerArray.length - 1; i>=0; i--) {
                if (listenerArray[i].equals(listener)) {
                    if (listenerArray[i] == listener) {
                        //was already added 
                        return false;
                    } else {
                        //was added but is a different instance
                        //it will be replaced
                        //clone the array in order to avoid concurrency issues 
                        Object[] tmp = new Object[listenerArray.length];
                        System.arraycopy(listenerArray, 0, tmp, 0, listenerArray.length);
                        tmp[i] = listener;
                        listenerArray = tmp;
                        return true;
                    }
                    
                }
            }
            // Otherwise copy the array and add the new listener
            int i = listenerArray.length;
            Object[] tmp = new Object[i+1];
            System.arraycopy(listenerArray, 0, tmp, 0, i);
            tmp[i] = listener;
            listenerArray = tmp;
        }
        return true;
    }