code: protected Future<T> addToListeners(
      final GenericCompletionListener<? extends Future<T>> listener) {
      if (listener == null) {
        throw new IllegalArgumentException("The listener can't be null.");
      }
  
      synchronized(this) {
        listeners.add(listener);
      }
  
      if(isDone()) {
        notifyListeners();
      }
  
      return this;
    }
docs: Add the given listener to the total list of listeners to be notified.
  
  <p>If the future is already done, the listener will be notified
  immediately.</p>
  
  @param listener the listener to add.
  @return the current future to allow chaining.