Search
Calendar
September 2017
S M T W T F S
« Sep    
 12
3456789
10111213141516
17181920212223
24252627282930
Your widget title
Archives

PostHeaderIcon Sonar / Synchronization on interned XYZ could lead to deadlock

How to fix the Sonar’s following report?

Multithreaded correctness - Synchronization on interned String could lead to deadlock 

Replace lock on String with a lock on an immutable and/or non-serializable object, ie a simple Object.
Eg:
Replace:

  synchronized ("myString") {…}

With:

  synchronized (myObject) {…}

Leave a Reply