cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From santhosheduku...@apache.org
Subject git commit: updated refs/heads/master to fd96ad0
Date Mon, 11 Aug 2014 11:26:24 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master f9e11540c -> fd96ad02d


Fixed few coverity reported issues around concurrency, null checks


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

Branch: refs/heads/master
Commit: fd96ad02d7a29a94927c74e6092a816e7d235cf9
Parents: f9e1154
Author: Santhosh Edukulla <santhosh.edukulla@gmail.com>
Authored: Mon Aug 11 16:55:23 2014 +0530
Committer: Santhosh Edukulla <santhosh.edukulla@gmail.com>
Committed: Mon Aug 11 16:55:23 2014 +0530

----------------------------------------------------------------------
 .../mom/rabbitmq/RabbitMQEventBus.java          |  5 ++--
 .../hyperv/manager/HypervManagerImpl.java       | 27 ++++++++++----------
 .../cloud/resource/DummyHostServerResource.java |  2 +-
 .../com/cloud/utils/concurrency/TestClock.java  | 24 ++++++++++++-----
 4 files changed, 35 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd96ad02/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
----------------------------------------------------------------------
diff --git a/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
b/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
index a1f4c2b..2d389f2 100644
--- a/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
+++ b/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
@@ -60,7 +60,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus {
     private static String username;
     private static String password;
 
-    public static void setVirtualHost(String virtualHost) {
+    public synchronized static void setVirtualHost(String virtualHost) {
         RabbitMQEventBus.virtualHost = virtualHost;
     }
 
@@ -481,8 +481,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus
{
     }
 
     @Override
-    public boolean stop() {
-
+    public synchronized boolean stop() {
         if (s_connection.isOpen()) {
             for (String subscriberId : s_subscribers.keySet()) {
                 Ternary<String, Channel, EventSubscriber> subscriberDetails = s_subscribers.get(subscriberId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd96ad02/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/manager/HypervManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/manager/HypervManagerImpl.java
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/manager/HypervManagerImpl.java
index 71a619a..c512445 100644
--- a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/manager/HypervManagerImpl.java
+++ b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/manager/HypervManagerImpl.java
@@ -359,20 +359,21 @@ public class HypervManagerImpl implements HypervManager {
 
     private void shutdownCleanup() {
         s_logger.info("Cleanup mounted mount points used in current session");
+        synchronized (_storageMounts) {
+             for (String mountPoint : _storageMounts.values()) {
+                s_logger.info("umount NFS mount: " + mountPoint);
 
-        for (String mountPoint : _storageMounts.values()) {
-            s_logger.info("umount NFS mount: " + mountPoint);
-
-            String result = null;
-            Script command = new Script(true, "umount", _timeout, s_logger);
-            command.add(mountPoint);
-            result = command.execute();
-            if (result != null) {
-                s_logger.warn("Unable to umount " + mountPoint + " due to " + result);
-            }
-            File file = new File(mountPoint);
-            if (file.exists()) {
-                file.delete();
+                String result = null;
+                Script command = new Script(true, "umount", _timeout, s_logger);
+                command.add(mountPoint);
+                result = command.execute();
+                if (result != null) {
+                    s_logger.warn("Unable to umount " + mountPoint + " due to " + result);
+                }
+                File file = new File(mountPoint);
+                if (file.exists()) {
+                    file.delete();
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd96ad02/server/src/com/cloud/resource/DummyHostServerResource.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/DummyHostServerResource.java b/server/src/com/cloud/resource/DummyHostServerResource.java
index 41f5d3d..d787b86 100644
--- a/server/src/com/cloud/resource/DummyHostServerResource.java
+++ b/server/src/com/cloud/resource/DummyHostServerResource.java
@@ -107,7 +107,7 @@ public class DummyHostServerResource extends ServerResourceBase {
         return true;
     }
 
-    public static int getNextSequenceId() {
+    public synchronized static int getNextSequenceId() {
         return s_nextSequence++;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd96ad02/utils/src/com/cloud/utils/concurrency/TestClock.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/concurrency/TestClock.java b/utils/src/com/cloud/utils/concurrency/TestClock.java
index 8104a94..43fe56f 100644
--- a/utils/src/com/cloud/utils/concurrency/TestClock.java
+++ b/utils/src/com/cloud/utils/concurrency/TestClock.java
@@ -61,27 +61,39 @@ public class TestClock extends TimerTask {
     }
 
     public int getMinute() {
-        return _minute;
+        synchronized (this) {
+            return _minute;
+        }
     }
 
     public int getHour() {
-        return _hour;
+        synchronized (this) {
+            return _hour;
+        }
     }
 
     public int getDay() {
-        return _day;
+        synchronized (this) {
+            return _day;
+        }
     }
 
     public int getWeek() {
-        return _week;
+        synchronized (this) {
+            return _week;
+        }
     }
 
     public int getMonth() {
-        return _month;
+        synchronized (this) {
+            return _month;
+        }
     }
 
     public int getYear() {
-        return _year;
+        synchronized (this) {
+            return _year;
+        }
     }
 
     public int getMinutesPerHour() {


Mime
View raw message