Can someone briefly explain on HOW and WHEN to use a ThreadFactory? An example with and without using ThreadFactory might be really helpful to understand the differences.
ThreadFactory will be useful
You could use ThreadFactoryBuilder from google Guava lib to create ThreadFactory like this
ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setNameFormat("MyThreadPool-Worker-%d")
.setDaemon(true)
.build();