Repository: cloudstack
Updated Branches:
  refs/heads/master 73ac5dd9d -> b7d3f1bd3


Fixed few coverity issues for resource synchronization


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b7d3f1bd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b7d3f1bd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b7d3f1bd

Branch: refs/heads/master
Commit: b7d3f1bd307a67b4d46dc29093d6845c3bcc333e
Parents: 73ac5dd
Author: Santhosh Edukulla <santhosh.eduku...@gmail.com>
Authored: Mon Aug 4 16:00:36 2014 +0530
Committer: Santhosh Edukulla <santhosh.eduku...@gmail.com>
Committed: Mon Aug 4 16:09:26 2014 +0530

----------------------------------------------------------------------
 .../src/com/cloud/agent/manager/AgentManagerImpl.java         | 4 +---
 server/src/com/cloud/resource/ResourceManagerImpl.java        | 7 +++----
 2 files changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7d3f1bd/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java 
b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
index af2d1b9..7dd948a 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -272,15 +272,13 @@ public class AgentManagerImpl extends ManagerBase 
implements AgentManager, Handl
     public int registerForInitialConnects(final StartupCommandProcessor 
creator, boolean priority) {
         synchronized (_hostMonitors) {
             _monitorId++;
-
             if (priority) {
                 _creationMonitors.add(0, new Pair<Integer, 
StartupCommandProcessor>(_monitorId, creator));
             } else {
                 _creationMonitors.add(new Pair<Integer, 
StartupCommandProcessor>(_monitorId, creator));
             }
+            return _monitorId;
         }
-
-        return _monitorId;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7d3f1bd/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java 
b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 6f089af..5008621 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -1438,11 +1438,10 @@ public class ResourceManagerImpl extends ManagerBase 
implements ResourceManager,
 
     @Override
     public void registerResourceStateAdapter(String name, ResourceStateAdapter 
adapter) {
-        if (_resourceStateAdapters.get(name) != null) {
-            throw new CloudRuntimeException(name + " has registered");
-        }
-
         synchronized (_resourceStateAdapters) {
+            if (_resourceStateAdapters.get(name) != null) {
+                throw new CloudRuntimeException(name + " has registered");
+            }
             _resourceStateAdapters.put(name, adapter);
         }
     }

Reply via email to