Code example for ThreadFactoryBuilder

0
            executor = new ThreadPoolExecutor(
                2, 
                8, 
                500, TimeUnit.SECONDS,
                new ArrayBlockingQueue<Runnable>(1000),
                new ThreadFactoryBuilder().setNameFormat("seyren.check-live-%s").build()
            ); 
            executor.prestartCoreThread();
        } else { 
            LOGGER.info("Carbon Pickle Listener disabled."); 
        } 
    } 
 
    @PreDestroy 
    public void preDestroy() throws InterruptedException {
        if (seyrenConfig.getGraphiteCarbonPickleEnable()) {
            executor.shutdown();
            while (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
                LOGGER.info("Awaiting completion of threads..."); 
            }