caolicaoli opened a new issue, #514:
URL: https://github.com/apache/rocketmq-spring/issues/514
1. Please describe the issue you observed:
- using transaction message.
- checkLocalTransaction use my threadpool
- now it only use the pool it created itslef with 1 max poolsize
i think these two method run in wrong order。。。。。
public void initTransactionEnv() {
TransactionMQProducer producer = (TransactionMQProducer)
this.defaultMQProducer;
if (producer.getExecutorService() != null) {
this.checkExecutor = producer.getExecutorService();
} else {
this.checkRequestQueue = new
LinkedBlockingQueue<Runnable>(producer.getCheckRequestHoldMax());
this.checkExecutor = new ThreadPoolExecutor(
producer.getCheckThreadPoolMinSize(),
producer.getCheckThreadPoolMaxSize(),
1000 * 60,
TimeUnit.MILLISECONDS,
this.checkRequestQueue);
}
}
private void registerTransactionListener(String beanName, Object bean) {
Class<?> clazz = AopProxyUtils.ultimateTargetClass(bean);
if
(!RocketMQLocalTransactionListener.class.isAssignableFrom(bean.getClass())) {
throw new IllegalStateException(clazz + " is not instance of " +
RocketMQLocalTransactionListener.class.getName());
}
RocketMQTransactionListener annotation =
clazz.getAnnotation(RocketMQTransactionListener.class);
RocketMQTemplate rocketMQTemplate = (RocketMQTemplate)
applicationContext.getBean(annotation.rocketMQTemplateBeanName());
if (((TransactionMQProducer)
rocketMQTemplate.getProducer()).getTransactionListener() != null) {
throw new
IllegalStateException(annotation.rocketMQTemplateBeanName() + " already exists
RocketMQLocalTransactionListener");
}
((TransactionMQProducer)
rocketMQTemplate.getProducer()).setExecutorService(new
ThreadPoolExecutor(annotation.corePoolSize(), annotation.maximumPoolSize(),
annotation.keepAliveTime(), annotation.keepAliveTimeUnit(), new
LinkedBlockingDeque<>(annotation.blockingQueueSize())));
((TransactionMQProducer)
rocketMQTemplate.getProducer()).setTransactionListener(RocketMQUtil.convert((RocketMQLocalTransactionListener)
bean));
log.debug("RocketMQLocalTransactionListener {} register to {}
success", clazz.getName(), annotation.rocketMQTemplateBeanName());
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]