mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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
This commit is contained in:
parent
25e9918c57
commit
bcc8182f2f
@ -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) {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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<?>>();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user