cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [34/50] git commit: updated refs/heads/CLOUDSTACK-8581 to 1a2e80b
Date Fri, 10 Jul 2015 10:08:29 GMT
findbugs: write to static from instance these are the trivial cases of ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD
as reported by findbugs

Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #539


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

Branch: refs/heads/CLOUDSTACK-8581
Commit: bcc8182f2ff9f3942116e6522b8e2d6e1761d9ff
Parents: 25e9918
Author: Daan Hoogland <daan.hoogland@gmail.com>
Authored: Mon Jun 29 16:35:18 2015 +0200
Committer: Daan Hoogland <daan.hoogland@gmail.com>
Committed: Thu Jul 9 15:01:58 2015 +0200

----------------------------------------------------------------------
 .../storage/image/format/ImageFormatHelper.java |  6 +++-
 .../mom/rabbitmq/RabbitMQEventBus.java          | 34 +++++++++++---------
 .../hypervisor/kvm/resource/KVMHAMonitor.java   |  8 +++--
 .../api/auth/APIAuthenticationManagerImpl.java  | 31 ++++++++++++------
 .../cloud/utils/component/ComponentContext.java |  4 +++
 5 files changed, 54 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcc8182f/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java
b/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java
index 5a424cb..352d9a8 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java
@@ -31,7 +31,11 @@ public class ImageFormatHelper {
 
     @Inject
     public void setFormats(List<ImageFormat> formats) {
-        ImageFormatHelper.formats = formats;
+        ImageFormatHelper.initFormats(formats);
+    }
+
+    private static synchronized void initFormats(List<ImageFormat> newFormats) {
+        formats = newFormats;
     }
 
     public static ImageFormat getFormat(String format) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcc8182f/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 bd414db..e53d2e9 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
@@ -30,16 +30,8 @@ import java.util.concurrent.Executors;
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
-import org.apache.cloudstack.framework.events.Event;
-import org.apache.cloudstack.framework.events.EventBus;
-import org.apache.cloudstack.framework.events.EventBusException;
-import org.apache.cloudstack.framework.events.EventSubscriber;
-import org.apache.cloudstack.framework.events.EventTopic;
-import org.apache.cloudstack.managed.context.ManagedContextRunnable;
 import org.apache.log4j.Logger;
 
-import com.cloud.utils.Ternary;
-import com.cloud.utils.component.ManagerBase;
 import com.rabbitmq.client.AMQP;
 import com.rabbitmq.client.AlreadyClosedException;
 import com.rabbitmq.client.Channel;
@@ -51,6 +43,16 @@ import com.rabbitmq.client.MessageProperties;
 import com.rabbitmq.client.ShutdownListener;
 import com.rabbitmq.client.ShutdownSignalException;
 
+import org.apache.cloudstack.framework.events.Event;
+import org.apache.cloudstack.framework.events.EventBus;
+import org.apache.cloudstack.framework.events.EventBusException;
+import org.apache.cloudstack.framework.events.EventSubscriber;
+import org.apache.cloudstack.framework.events.EventTopic;
+import org.apache.cloudstack.managed.context.ManagedContextRunnable;
+
+import com.cloud.utils.Ternary;
+import com.cloud.utils.component.ManagerBase;
+
 @Local(value = EventBus.class)
 public class RabbitMQEventBus extends ManagerBase implements EventBus {
 
@@ -138,23 +140,23 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus
{
         return true;
     }
 
-    public void setServer(String amqpHost) {
+    public static void setServer(String amqpHost) {
         RabbitMQEventBus.amqpHost = amqpHost;
     }
 
-    public void setUsername(String username) {
+    public static void setUsername(String username) {
         RabbitMQEventBus.username = username;
     }
 
-    public void setPassword(String password) {
+    public static void setPassword(String password) {
         RabbitMQEventBus.password = password;
     }
 
-    public void setPort(Integer port) {
+    public static void setPort(Integer port) {
         RabbitMQEventBus.port = port;
     }
 
-    public void setSecureProtocol(String protocol) {
+    public static void setSecureProtocol(String protocol) {
         RabbitMQEventBus.secureProtocol = protocol;
     }
 
@@ -163,11 +165,11 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus
{
         this.name = name;
     }
 
-    public void setExchange(String exchange) {
+    public static void setExchange(String exchange) {
         RabbitMQEventBus.amqpExchangeName = exchange;
     }
 
-    public void setRetryInterval(Integer retryInterval) {
+    public static void setRetryInterval(Integer retryInterval) {
         RabbitMQEventBus.retryInterval = retryInterval;
     }
 
@@ -378,7 +380,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus
{
             }
 
             if (useSsl != null && !useSsl.isEmpty() && useSsl.equalsIgnoreCase("true"))
{
-                factory.useSslProtocol(this.secureProtocol);
+                factory.useSslProtocol(secureProtocol);
             }
             Connection connection = factory.newConnection();
             connection.addShutdownListener(disconnectHandler);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcc8182f/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java
index 8695045..5407d76 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java
@@ -35,15 +35,19 @@ import com.cloud.utils.script.Script;
 
 public class KVMHAMonitor extends KVMHABase implements Runnable {
     private static final Logger s_logger = Logger.getLogger(KVMHAMonitor.class);
-    private Map<String, NfsStoragePool> _storagePool = new ConcurrentHashMap<String,
NfsStoragePool>();
+    private final Map<String, NfsStoragePool> _storagePool = new ConcurrentHashMap<String,
NfsStoragePool>();
 
-    private String _hostIP; /* private ip address */
+    private final String _hostIP; /* private ip address */
 
     public KVMHAMonitor(NfsStoragePool pool, String host, String scriptPath) {
         if (pool != null) {
             _storagePool.put(pool._poolUUID, pool);
         }
         _hostIP = host;
+        configureHeartBeatPath(scriptPath);
+    }
+
+    private static synchronized void configureHeartBeatPath(String scriptPath) {
         KVMHABase.s_heartBeatPath = scriptPath;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcc8182f/server/src/com/cloud/api/auth/APIAuthenticationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/auth/APIAuthenticationManagerImpl.java b/server/src/com/cloud/api/auth/APIAuthenticationManagerImpl.java
index 9d0ab68..28a9c0f 100644
--- a/server/src/com/cloud/api/auth/APIAuthenticationManagerImpl.java
+++ b/server/src/com/cloud/api/auth/APIAuthenticationManagerImpl.java
@@ -16,19 +16,22 @@
 // under the License.
 package com.cloud.api.auth;
 
-import com.cloud.utils.component.ComponentContext;
-import com.cloud.utils.component.ManagerBase;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.auth.APIAuthenticationManager;
 import org.apache.cloudstack.api.auth.APIAuthenticator;
 import org.apache.cloudstack.api.auth.PluggableAPIAuthenticator;
-import org.apache.log4j.Logger;
 
-import javax.ejb.Local;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import com.cloud.utils.component.ComponentContext;
+import com.cloud.utils.component.ManagerBase;
 
 @Local(value = APIAuthenticationManager.class)
 @SuppressWarnings("unchecked")
@@ -52,17 +55,25 @@ public class APIAuthenticationManagerImpl extends ManagerBase implements
APIAuth
 
     @Override
     public boolean start() {
-        s_authenticators = new HashMap<String, Class<?>>();
+        initAuthenticator();
         for (Class<?> authenticator: getCommands()) {
             APICommand command = authenticator.getAnnotation(APICommand.class);
             if (command != null && !command.name().isEmpty()
                     && APIAuthenticator.class.isAssignableFrom(authenticator)) {
-                s_authenticators.put(command.name().toLowerCase(), authenticator);
+                addAuthenticator(authenticator, command);
             }
         }
         return true;
     }
 
+    private static synchronized void addAuthenticator(Class<?> authenticator, APICommand
command) {
+        s_authenticators.put(command.name().toLowerCase(), authenticator);
+    }
+
+    private static synchronized void initAuthenticator() {
+        s_authenticators = new ConcurrentHashMap<String, Class<?>>();
+    }
+
     @Override
     public List<Class<?>> getCommands() {
         List<Class<?>> cmdList = new ArrayList<Class<?>>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcc8182f/utils/src/com/cloud/utils/component/ComponentContext.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/component/ComponentContext.java b/utils/src/com/cloud/utils/component/ComponentContext.java
index b041ecf..8948b27 100644
--- a/utils/src/com/cloud/utils/component/ComponentContext.java
+++ b/utils/src/com/cloud/utils/component/ComponentContext.java
@@ -273,6 +273,10 @@ public class ComponentContext implements ApplicationContextAware {
     }
 
     public void setInitializeBeans(boolean initializeBeans) {
+        initInitializeBeans(initializeBeans);
+    }
+
+    private static synchronized void initInitializeBeans(boolean initializeBeans) {
         s_initializeBeans = initializeBeans;
     }
 }


Mime
View raw message