You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When implementing the Transaction demo of Java, there is a question: the ExecutorService that implements a ThreadPool is passed to the TransactionMQProducer.
When producer shutdown , is throw a Exception of NullPointException.
Check source code and found in the destroyTransactionEnv of DefaultMQProducerImpl checkRequestQueue is null. And found in the initTransactionEnv of DefaultMQProducerImpl, after initializing the executorService, the checkRequestQueue will not be initialized, causing it to be empty. And no manually added position in TransactionProducer. How can I solve this problem?
Source code:
public void initTransactionEnv() {
TransactionMQProducer producer = (TransactionMQProducer) this.defaultMQProducer;
if (producer.getExecutorService() != null) {
this.checkExecutor = producer.getExecutorService();
} else {
this.checkRequestQueue = new LinkedBlockingQueue<Runnable>(2000);
this.checkExecutor = new ThreadPoolExecutor(
1,
1,
1000 * 60,
TimeUnit.MILLISECONDS,
this.checkRequestQueue);
}
}
public void destroyTransactionEnv() {
this.checkExecutor.shutdown();
this.checkRequestQueue.clear();
}
The text was updated successfully, but these errors were encountered:
laiyy0728
changed the title
A problem when using TransactionProducer (4.3.0-Release)
A problem when using TransactionMQProducer (4.3.0-Release)
Aug 7, 2018
@laiyy0728 yep,this is really an issue, actually there is no need to clear the queue anymore, because the tasks in the queue will be processed after shutdown. you can modify this and pull a request ,we are glad to see your contribution.
When implementing the Transaction demo of Java, there is a question: the ExecutorService that implements a ThreadPool is passed to the TransactionMQProducer.
When producer shutdown , is throw a Exception of NullPointException.
Check source code and found in the destroyTransactionEnv of DefaultMQProducerImpl checkRequestQueue is null. And found in the initTransactionEnv of DefaultMQProducerImpl, after initializing the executorService, the checkRequestQueue will not be initialized, causing it to be empty. And no manually added position in TransactionProducer. How can I solve this problem?
Source code:
The text was updated successfully, but these errors were encountered: