public void addListener(final T listener) {
    Preconditions.checkNotNull(listener, "Internal Error: Listener cannot be null");

    if (m_listeners == null) {
      synchronized (this) {
        if (m_listeners == null) {
          m_listeners = new LinkedHashSet<WeakReference<T>>();
        }
      }
    }

    synchronized (m_listeners) {
      if (!m_listeners.add(new ComparableReference(listener))) {
        // throw new IllegalStateException(String.format(
        // "Internal Error: Listener '%s' can not be added more than once.", listener));
      }
    }
  }
Adds a listener to the listener provider.

@param listener The listener to add.
@throws NullPointerException Thrown if the listener object is null.
@throws IllegalStateException Thrown if the listener is already managed by the listener
    provider.
java/zylib/src/main/java/com/google/security/zynamics/zylib/general/ListenerProvider.java