code: public void addListener (ChangeListener listener, boolean weak)
      {
          // only add the listener if they're not already there
          int idx = getListenerIndex(listener);
          if (idx == -1) {
              _listeners = ListUtil.add(_listeners,
                  weak ? new WeakReference<Object>(listener) : listener);
              return;
          }
          boolean oweak = _listeners[idx] instanceof WeakReference<?>;
          if (weak == oweak) {
              log.warning("Refusing repeat listener registration",
                  "dobj", which(), "list", listener, new Exception());
          } else {
              log.warning("Updating listener registered under different strength.",
                  "dobj", which(), "list", listener, "oweak", oweak, "nweak", weak, new Exception());
              _listeners[idx] = weak ? new WeakReference<Object>(listener) : listener;
          }
      }
docs: Adds an event listener to this object. The listener will be notified when any events are
  dispatched on this object that match their particular listener interface.
  
  <p> Note that the entity adding itself as a listener should have obtained the object
  reference by subscribing to it or should be acting on behalf of some other entity that
  subscribed to the object, <em>and</em> that it must be sure to remove itself from the
  listener list (via {@link #removeListener}) when it is done because unsubscribing from the
  object (done by whatever entity subscribed in the first place) is not guaranteed to result
  in the listeners added through that subscription being automatically removed (in most cases,
  they definitely will not be removed).
  
  @param listener the listener to be added.
  @param weak if true, retain only a weak reference to the listener (do not prevent the
  listener from being garbage-collected).
  
  @see EventListener
  @see AttributeChangeListener
  @see SetListener
  @see OidListListener