Code example for ThreadFactoryBuilder

0
                  event.getAccessCount().set(0);
                  KMSAudit.this.cache.put(entry.getKey(), event);
                } 
              } 
            }).build();
    executor = Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder()
        .setDaemon(true).setNameFormat(KMS_LOGGER_NAME + "_thread").build());
    executor.scheduleAtFixedRate(new Runnable() {
      @Override 
      public void run() { 
        cache.cleanUp();
      } 
    }, windowMs / 10, windowMs / 10, TimeUnit.MILLISECONDS);
  } 
 
  private void logEvent(AuditEvent event) {
    AUDIT_LOG.info( 
        "OK[op={}, key={}, user={}, accessCount={}, interval={}ms] {}", 
        event.getOp(), event.getKeyName(), event.getUser(),
        event.getAccessCount().get(),
Experience pair programming with AI  Get Codota for Java