mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fixed few coverity issues for resource synchronization
This commit is contained in:
parent
73ac5dd9d0
commit
b7d3f1bd30
@ -272,16 +272,14 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
|||||||
public int registerForInitialConnects(final StartupCommandProcessor creator, boolean priority) {
|
public int registerForInitialConnects(final StartupCommandProcessor creator, boolean priority) {
|
||||||
synchronized (_hostMonitors) {
|
synchronized (_hostMonitors) {
|
||||||
_monitorId++;
|
_monitorId++;
|
||||||
|
|
||||||
if (priority) {
|
if (priority) {
|
||||||
_creationMonitors.add(0, new Pair<Integer, StartupCommandProcessor>(_monitorId, creator));
|
_creationMonitors.add(0, new Pair<Integer, StartupCommandProcessor>(_monitorId, creator));
|
||||||
} else {
|
} else {
|
||||||
_creationMonitors.add(new Pair<Integer, StartupCommandProcessor>(_monitorId, creator));
|
_creationMonitors.add(new Pair<Integer, StartupCommandProcessor>(_monitorId, creator));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return _monitorId;
|
return _monitorId;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unregisterForHostEvents(final int id) {
|
public void unregisterForHostEvents(final int id) {
|
||||||
|
|||||||
@ -1438,11 +1438,10 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerResourceStateAdapter(String name, ResourceStateAdapter adapter) {
|
public void registerResourceStateAdapter(String name, ResourceStateAdapter adapter) {
|
||||||
|
synchronized (_resourceStateAdapters) {
|
||||||
if (_resourceStateAdapters.get(name) != null) {
|
if (_resourceStateAdapters.get(name) != null) {
|
||||||
throw new CloudRuntimeException(name + " has registered");
|
throw new CloudRuntimeException(name + " has registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (_resourceStateAdapters) {
|
|
||||||
_resourceStateAdapters.put(name, adapter);
|
_resourceStateAdapters.put(name, adapter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user