mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-7539: no return in synchronised block
This commit is contained in:
parent
780816ee9f
commit
c3d28e1b96
@ -223,7 +223,7 @@ public class StorageCacheManagerImpl implements StorageCacheManager, Manager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataObject createCacheObject(DataObject data, DataStore store) {
|
public DataObject createCacheObject(DataObject data, DataStore store) {
|
||||||
DataObject objOnCacheStore;
|
DataObject objOnCacheStore = null;
|
||||||
final Object lock;
|
final Object lock;
|
||||||
final DataObjectType type = data.getType();
|
final DataObjectType type = data.getType();
|
||||||
final String typeName;
|
final String typeName;
|
||||||
@ -249,6 +249,7 @@ public class StorageCacheManagerImpl implements StorageCacheManager, Manager {
|
|||||||
}
|
}
|
||||||
s_logger.debug("check " + typeName + " cache entry(id: " + dataId + ") on store(id: " + storeId + ")");
|
s_logger.debug("check " + typeName + " cache entry(id: " + dataId + ") on store(id: " + storeId + ")");
|
||||||
|
|
||||||
|
DataObject existingDataObj = null;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
DataObjectInStore obj = objectInStoreMgr.findObject(data, store);
|
DataObjectInStore obj = objectInStoreMgr.findObject(data, store);
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
@ -292,12 +293,22 @@ public class StorageCacheManagerImpl implements StorageCacheManager, Manager {
|
|||||||
s_logger.debug("there is already one in the cache store");
|
s_logger.debug("there is already one in the cache store");
|
||||||
DataObject dataObj = objectInStoreMgr.get(data, store);
|
DataObject dataObj = objectInStoreMgr.get(data, store);
|
||||||
dataObj.incRefCount();
|
dataObj.incRefCount();
|
||||||
return dataObj;
|
existingDataObj = dataObj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s_logger.debug("create " + typeName + " cache entry(id: " + dataId + ") on store(id: " + storeId + ")");
|
if(existingDataObj == null) {
|
||||||
objOnCacheStore = store.create(data);
|
s_logger.debug("create " + typeName + " cache entry(id: " + dataId + ") on store(id: " + storeId + ")");
|
||||||
|
objOnCacheStore = store.create(data);
|
||||||
|
}
|
||||||
|
lock.notifyAll();
|
||||||
|
}
|
||||||
|
if (existingDataObj != null) {
|
||||||
|
return existingDataObj;
|
||||||
|
}
|
||||||
|
if (objOnCacheStore == null) {
|
||||||
|
s_logger.error("create " + typeName + " cache entry(id: " + dataId + ") on store(id: " + storeId + ") failed");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncCallFuture<CopyCommandResult> future = new AsyncCallFuture<CopyCommandResult>();
|
AsyncCallFuture<CopyCommandResult> future = new AsyncCallFuture<CopyCommandResult>();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user