code: private synchronized Object progressiveListeners() {
          Object listeners = this.listeners;
          if (listeners == null) {
              // No listeners added
              return null;
          }
  
          if (listeners instanceof DefaultFutureListeners) {
              // Copy DefaultFutureListeners into an array of listeners.
              DefaultFutureListeners dfl = (DefaultFutureListeners) listeners;
              int progressiveSize = dfl.progressiveSize();
              switch (progressiveSize) {
                  case 0:
                      return null;
                  case 1:
                      for (GenericFutureListener<?> l: dfl.listeners()) {
                          if (l instanceof GenericProgressiveFutureListener) {
                              return l;
                          }
                      }
                      return null;
              }
  
              GenericFutureListener<?>[] array = dfl.listeners();
              GenericProgressiveFutureListener<?>[] copy = new GenericProgressiveFutureListener[progressiveSize];
              for (int i = 0, j = 0; j < progressiveSize; i ++) {
                  GenericFutureListener<?> l = array[i];
                  if (l instanceof GenericProgressiveFutureListener) {
                      copy[j ++] = (GenericProgressiveFutureListener<?>) l;
                  }
              }
  
              return copy;
          } else if (listeners instanceof GenericProgressiveFutureListener) {
              return listeners;
          } else {
              // Only one listener was added and it's not a progressive listener.
              return null;
          }
      }
docs: Returns a {@link GenericProgressiveFutureListener}, an array of {@link GenericProgressiveFutureListener}, or
  {@code null}.