You will need to use the ExecutorService
implementation, which allows you to set ThreadFactory
1 , used to create threads, for example, ThreadPoolExecutor
. Pass the instance that creates the streams with names.
There is also a handy class in commons-lang that allows you to specify thread names with a pattern: BasicThreadFactory
. This ThreadFactory
you from subclassing ThreadFactory
to provide naming behavior.
scompt.com
source share