code: public static <T> T register(MeterRegistry registry, MeterIdPrefix idPrefix, Class<T> type,
                                   BiFunction<MeterRegistry, MeterIdPrefix, T> factory) {
          requireNonNull(registry, "registry");
          requireNonNull(idPrefix, "idPrefix");
          requireNonNull(type, "type");
          requireNonNull(factory, "factory");
  
          final ConcurrentMap<MeterIdPrefix, Object> objects =
                  map.computeIfAbsent(registry, unused -> new ConcurrentHashMap<>());
  
          // Prevent calling computeIfAbsent inside computeIfAbsent.
          // See https://bugs.openjdk.java.net/browse/JDK-8062841 for more information.
          final RegistrationState registrationState = MicrometerUtil.registrationState.get();
          if (registrationState.isRegistering) {
              throw new IllegalStateException("nested registration prohibited");
          }
  
          final Object object = register(objects, registrationState, registry, idPrefix, type, factory);
  
          // Handle the registerLater() calls, if any were made by the factory.
          handlePendingRegistrations(objects, registrationState);
  
          @SuppressWarnings("unchecked")
          final T cast = (T) object;
          return cast;
      }
docs: Associates a newly-created object with the specified {@link MeterIdPrefix} or returns an existing one if
  exists already.
  
  @param idPrefix the {@link MeterIdPrefix} of the object
  @param type the type of the object created by {@code factory}
  @param factory a factory that creates an object of {@code type}, to be associated with {@code idPrefix}
  
  @return the object of {@code type}, which may or may not be created by {@code factory}
  @throws IllegalStateException if there is already an object of different class associated
  for the same {@link MeterIdPrefix}