If this asynchronous operation is non-transaction related to the previous logic. That is to say, they are not in the same transaction. Then you can use a new link.
If there is a transaction, this old link must be used. This connection object can only be passed to the thread.
The connection must be released after each use. The next time you connect, just go to threadlocal to get the value. I don’t understand what you mean.
When creating a new Thread, take the connection out of ThreadLocal and pass it in
Isn’t there a way to get the connection?
Just write the execution part independently, so you don’t need to pass the dao to Thread
If this asynchronous operation is non-transaction related to the previous logic. That is to say, they are not in the same transaction.
Then you can use a new link.
If there is a transaction, this old link must be used. This connection object can only be passed to the thread.