tristaZero commented on pull request #6359:
URL: https://github.com/apache/shardingsphere/pull/6359#issuecomment-660778759


   @SirMin 
   
   > The current situation is that different threads are also returning 
different objects
   
   It is supposed to be that. If not, it is unsafe when multiple threads modify 
it together.
   
   > and without looking at the source code, I subconsciously think that this 
should be the object held by the current thread in each call,
   
   I agree with you. `getInstance` always makes us believe it will return the 
same Instance. If we plan to return a new instance each time, `newInstance` 
will be better.
   
   > And after calling get Instance, you must call close or clear, otherwise an 
error will be reported. Is this design reasonable? 
   
   `close()` function is supposed to be called by users. I am with you to some 
extent, but what the most concerned me that if `getInstance` always returns the 
same Instance, users are very likely to believe it works well even in child 
threads. But the fact is that a new one will be returned in other threads. How 
do we avoid this case?


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to