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
The Twilio class has a bunch of multithreading issues. I fundamentally disagree with using singletons that are mutable, but if you're going to do it, it needs to be thread safe.
Here's what I recommend:
add synchronized to all set* and init* methods . These methods are called infrequently so the synchronization penalty will be minimal
Make the restClient and executorService fields volatile
For getRestClient and getExecutorService we can minimize the synchronization by doing the double null check trick. Here is an example pattern on how to use it:
Version:
7.22.0
Steps to Reproduce
The Twilio class has a bunch of multithreading issues. I fundamentally disagree with using singletons that are mutable, but if you're going to do it, it needs to be thread safe.
Here's what I recommend:
The text was updated successfully, but these errors were encountered: