Code example for ThreadFactoryBuilder

0
 
  /** 
   * @see org.sonar.server.platform.SwitchLogbackAppender 
   */ 
  private ThreadFactory threadFactoryWithSpecificNameForLogging() {
    return new ThreadFactoryBuilder()
      .setNameFormat(ANALYSIS_REPORT_THREAD_NAME_PREFIX + "%d").setPriority(Thread.MIN_PRIORITY).build();
  } 
 
  @Override 
  public void start() { 
    // do nothing because we want to wait for the server to finish startup 
  } 
 
  @Override 
  public void stop() { 
    executorService.shutdown();
    LOG.info("AnalysisReportTaskLauncher gracefully stopped"); 
  }