假设您有以下代码:
private String cachedToken;
private final Object lockObject = new Object();
....
retrieveToken(){
synchronized(lockObject){
if (cachedToken == null){
cachedToken = goGetNewToken();
}
return cachedToken;
}
}
cachedToken
所有已锁定的线程都可以看到写入lockObject
吗?