下面列出了怎么用org.springframework.util.CustomizableThreadCreator的API类实例代码及写法,或者点击链接到github查看源代码。
LazyTraceThreadPoolTaskScheduler(BeanFactory beanFactory,
ThreadPoolTaskScheduler delegate) {
this.beanFactory = beanFactory;
this.delegate = delegate;
this.initializeExecutor = ReflectionUtils
.findMethod(ThreadPoolTaskScheduler.class, "initializeExecutor", null);
makeAccessibleIfNotNull(this.initializeExecutor);
this.createExecutor = ReflectionUtils.findMethod(ThreadPoolTaskScheduler.class,
"createExecutor", null);
makeAccessibleIfNotNull(this.createExecutor);
this.cancelRemainingTask = ReflectionUtils
.findMethod(ThreadPoolTaskScheduler.class, "cancelRemainingTask", null);
makeAccessibleIfNotNull(this.cancelRemainingTask);
this.nextThreadName = ReflectionUtils.findMethod(ThreadPoolTaskScheduler.class,
"nextThreadName", null);
makeAccessibleIfNotNull(this.nextThreadName);
this.getDefaultThreadNamePrefix = ReflectionUtils.findMethod(
CustomizableThreadCreator.class, "getDefaultThreadNamePrefix", null);
makeAccessibleIfNotNull(this.getDefaultThreadNamePrefix);
}
LazyTraceThreadPoolTaskScheduler(ThreadPoolTaskScheduler delegate) {
this.delegate = delegate;
this.initializeExecutor = ReflectionUtils
.findMethod(ThreadPoolTaskScheduler.class, "initializeExecutor", null);
makeAccessibleIfNotNull(this.initializeExecutor);
this.createExecutor = ReflectionUtils.findMethod(ThreadPoolTaskScheduler.class,
"createExecutor", null);
makeAccessibleIfNotNull(this.createExecutor);
this.cancelRemainingTask = ReflectionUtils
.findMethod(ThreadPoolTaskScheduler.class, "cancelRemainingTask", null);
makeAccessibleIfNotNull(this.cancelRemainingTask);
this.nextThreadName = ReflectionUtils.findMethod(ThreadPoolTaskScheduler.class,
"nextThreadName", null);
makeAccessibleIfNotNull(this.nextThreadName);
this.getDefaultThreadNamePrefix = ReflectionUtils.findMethod(
CustomizableThreadCreator.class, "getDefaultThreadNamePrefix", null);
makeAccessibleIfNotNull(this.getDefaultThreadNamePrefix);
}
@Test
public void threadNamePrefix() {
CustomizableThreadCreator executor = this.context.getBean("default", CustomizableThreadCreator.class);
assertEquals("default-", executor.getThreadNamePrefix());
}
@Test
public void threadNamePrefix() {
CustomizableThreadCreator executor = this.context.getBean("default", CustomizableThreadCreator.class);
assertEquals("default-", executor.getThreadNamePrefix());
}
@Test
public void threadNamePrefix() {
CustomizableThreadCreator executor = this.context.getBean("default", CustomizableThreadCreator.class);
assertEquals("default-", executor.getThreadNamePrefix());
}