code: public static synchronized boolean assertSingleton(final String scopeId, final Class clazz) {
      ALL_CLASSES.add(clazz);
      return SINGLETONS_SCOPED.add(new Tuple<>(scopeId, clazz)) && !SINGLETONS_GLOBAL.contains(clazz);
    }
docs: Check if given class is singleton within a particular environment or scope.
  @param scopeId Environment id, e.g. Driver name or REEF job id.
  @param clazz Class that must have no more than 1 instance in that environment.
  @return true if the instance is unique within that particular environment, false otherwise.