ScheduledExecutorService createSchedulerExecutor ( final String prefix ) { ThreadFactory threadFactory = new ThreadFactory ( ) { private int counter = 0 ; @ Override public Thread newThread ( Runnable runnable ) { return new Thread ( runnable , prefix + ++ counter ) ; } } ; ScheduledExecutorService executor = java . util . concurrent . Executors . newSingleThreadScheduledExecutor ( threadFactory ) ; return executor ; }
create scheduler ThreadPoolExecutor