Code example for ThreadFactoryBuilder

  static int getInstanceThreadPoolSize() { 
    return instanceThreadPoolSize;
  private SimpleTimer(int threadPoolSize) {
    executor = Executors.newScheduledThreadPool(threadPoolSize, new ThreadFactoryBuilder().setNameFormat("SimpleTimer-%d").setDaemon(true)
      .setUncaughtExceptionHandler(new ExceptionHandler()).build());
   * Schedules a task to run in the future. 
   * @param task task to run 
   * @param delay number of milliseconds to wait before execution 
   * @return future for scheduled task 
  public ScheduledFuture<?> schedule(Runnable task, long delay) {
    return executor.schedule(task, delay, TimeUnit.MILLISECONDS);
Connect your IDE to all the code out there  Get Codota for Java