How to thread safe public static methods:
If any third party public methods which are not thread safe, create global locks.
Sample Code:
static Object internalLock = new Object() ;
synchronize(internalLock){
call public API;
}
If any third party public methods which are not thread safe, create global locks.
Sample Code:
static Object internalLock = new Object() ;
synchronize(internalLock){
call public API;
}
No comments:
Post a Comment