Code example for ThreadFactoryBuilder

0
     * Start scheduling tasks with a default thread pool, sized based on the 
     * number of available processors. 
     */ 
    public void start() { 
        int numThreads = Runtime.getRuntime().availableProcessors();
        ThreadFactory factory = new ThreadFactoryBuilder()
            .setDaemon(true)
            .setNameFormat("ServoPollScheduler-%d")
            .build();
        start(Executors.newScheduledThreadPool(numThreads, factory));
    } 
 
    /** 
     * Start the poller with the given executor service. 
     */ 
    public void start(ScheduledExecutorService service) {
        if (!executor.compareAndSet(null, service)) {
            throw new IllegalStateException("cannot start scheduler again without stopping it");
        } 
    } 
Connect your IDE to all the code out there  Get Codota for Java