List of usage examples for org.springframework.scheduling.concurrent ThreadPoolTaskExecutor setDaemon
public void setDaemon(boolean daemon)
From source file:com.apress.prospringintegration.concurrency.taskexecutorexample.TaskExecutorExampleConfiguration.java
@Bean public ThreadPoolTaskExecutor threadPoolTaskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(50);// w w w . ja v a2 s.com executor.setDaemon(false); executor.setWaitForTasksToCompleteOnShutdown(true); executor.setMaxPoolSize(100); executor.setAllowCoreThreadTimeOut(true); return executor; }
From source file:dk.clanie.actor.ActorAnnotationBeanPostProcessor.java
public Object postProcessAfterInitialization(Object bean, String beanName) { if (bean instanceof AopInfrastructureBean) { // Ignore AOP infrastructure such as scoped proxies. return bean; }//from w w w . j a va 2s.c o m Class<?> targetClass = AopUtils.getTargetClass(bean); Actor annotation = AnnotationUtils.findAnnotation(targetClass, Actor.class); if (annotation != null) { // if (AopUtils.canApply(this.asyncAnnotationAdvisor, targetClass)) { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setMaxPoolSize(1); executor.setDaemon(true); String threadNamePrefix = beanName + ","; executor.setThreadNamePrefix(threadNamePrefix); executor.initialize(); ActorAnnotationAdvisor actorAnnotationAdvisor = new ActorAnnotationAdvisor(executor); if (bean instanceof Advised) { ((Advised) bean).addAdvisor(0, actorAnnotationAdvisor); return bean; } else { ProxyFactory proxyFactory = new ProxyFactory(bean); // Copy our properties (proxyTargetClass etc) inherited from ProxyConfig. proxyFactory.copyFrom(this); proxyFactory.addAdvisor(actorAnnotationAdvisor); return proxyFactory.getProxy(this.beanClassLoader); } } else { // No async proxy needed. return bean; } }
From source file:com.github.woonsan.jackrabbit.migration.datastore.batch.BatchConfiguration.java
@Bean public TaskExecutor taskExecutor() { final ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); taskExecutor.setCorePoolSize(getMinWorkers()); taskExecutor.setMaxPoolSize(getMaxWorkers()); taskExecutor.setDaemon(true); return taskExecutor; }
From source file:org.red5.client.net.rtmp.RTMPConnManager.java
/** * Creates a connection instance based on the supplied type. * /*from w w w .j a v a2 s . c o m*/ * @param cls * @return connection * @throws Exception */ public RTMPConnection createConnectionInstance(Class<?> cls) throws Exception { RTMPConnection conn = null; if (cls == RTMPMinaConnection.class) { conn = (RTMPMinaConnection) cls.newInstance(); } else if (cls == RTMPTClientConnection.class) { conn = (RTMPTClientConnection) cls.newInstance(); } else { conn = (RTMPConnection) cls.newInstance(); } conn.setMaxHandshakeTimeout(maxHandshakeTimeout); conn.setMaxInactivity(maxInactivity); conn.setPingInterval(pingInterval); // setup executor ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(1); executor.setDaemon(true); executor.setMaxPoolSize(1); executor.setQueueCapacity(executorQueueCapacity); executor.initialize(); conn.setExecutor(executor); return conn; }
From source file:org.eclipse.gemini.blueprint.extender.internal.support.ExtenderConfiguration.java
private TaskExecutor createDefaultShutdownTaskExecutor() { ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); taskExecutor.setDaemon(true); taskExecutor.setCorePoolSize(2);/*from w ww. j a va2s .co m*/ taskExecutor.setMaxPoolSize(3); taskExecutor.setThreadNamePrefix("Gemini Blueprint context shutdown thread"); taskExecutor.afterPropertiesSet(); isShutdownTaskExecutorManagedInternally = true; return taskExecutor; }