code: synchronized void register(LogWithPatternAndLevel log, Duration period) {
  
          // if we haven't seen this period before, we'll need to add a schedule to the ScheduledExecutorService
          // to perform a counter reset with that periodicity, otherwise we can count on the existing schedule
          // taking care of it.
          boolean needToScheduleReset = false;
  
          ConcurrentHashMap<LogWithPatternAndLevel, Boolean> logLinesForPeriod = registry.get(period);
          if (logLinesForPeriod == null) {
              needToScheduleReset = true;
              logLinesForPeriod = new ConcurrentHashMap<>();
              registry.put(period, logLinesForPeriod);
  
          } else {
              if (logLinesForPeriod.get(log) != null) {
                  return;     // this has already been registered
              }
          }
          logLinesForPeriod.put(log, Boolean.TRUE);
  
          if (needToScheduleReset) {
              final ConcurrentHashMap<LogWithPatternAndLevel, Boolean> finalLogLinesForPeriod = logLinesForPeriod;
              resetScheduler.scheduleWithFixedDelay(() -> {
                  try {
                      resetAllCounters(finalLogLinesForPeriod);
                  } catch (Exception e) {
                      logger.warn("failed to reset counters: " + e, e);
                      // but carry on in the next iteration
                  }
              }, period.toMillis(), period.toMillis(), TimeUnit.MILLISECONDS);
          }
      }
docs: Register a new @param log, with a reset periodicity of @param period.  This happens relatively infrequently,
  so synchronization is ok (and safer)
  
  @throws IllegalStateException if we run out of space in the registry for that period.