code: @SuppressWarnings("unchecked")
      static <T extends RunListener> Optional<T> getAttachedListener(Class<T> listenerType) {
          synchronized(runListenerLoader) {
              for (RunListener listener : runListenerLoader) {
                  if (listener.getClass() == listenerType) {
                      return Optional.of((T) listener);
                  }
              }
          }
          return Optional.absent();
      }
docs: Get reference to an instance of the specified listener type.
  
  @param <T> listener type
  @param listenerType listener type
  @return optional listener instance