Search
Calendar
November 2017
S M T W T F S
« Sep    
 1234
567891011
12131415161718
19202122232425
2627282930  
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