mirror of
https://github.com/apache/cloudstack
synced 2026-08-02 05:26:35 +00:00
Fixed few coverity reported issues around concurrency, null checks
This commit is contained in:
parent
f9e11540c7
commit
fd96ad02d7
@ -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);
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ public class DummyHostServerResource extends ServerResourceBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int getNextSequenceId() {
|
||||
public synchronized static int getNextSequenceId() {
|
||||
return s_nextSequence++;
|
||||
}
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user