diff --git a/deps/.classpath b/deps/.classpath index cf95367164d..a8ad7191ee9 100755 --- a/deps/.classpath +++ b/deps/.classpath @@ -42,9 +42,7 @@ - - diff --git a/deps/vmware-lib-mailapi.jar b/deps/vmware-lib-mailapi.jar deleted file mode 100644 index 2f8620b6d4a..00000000000 Binary files a/deps/vmware-lib-mailapi.jar and /dev/null differ diff --git a/deps/vmware-lib-smtp.jar b/deps/vmware-lib-smtp.jar deleted file mode 100644 index 145d302d28a..00000000000 Binary files a/deps/vmware-lib-smtp.jar and /dev/null differ diff --git a/server/src/com/cloud/cluster/ClusterManagerImpl.java b/server/src/com/cloud/cluster/ClusterManagerImpl.java index ac2db9ec4ab..11b5149fd4e 100644 --- a/server/src/com/cloud/cluster/ClusterManagerImpl.java +++ b/server/src/com/cloud/cluster/ClusterManagerImpl.java @@ -86,14 +86,14 @@ public class ClusterManagerImpl implements ClusterManager { private static final int EXECUTOR_SHUTDOWN_TIMEOUT = 1000; // 1 second - private final List listeners = new ArrayList(); - private final Map activePeers = new HashMap(); - private int heartbeatInterval = ClusterManager.DEFAULT_HEARTBEAT_INTERVAL; - private int heartbeatThreshold = ClusterManager.DEFAULT_HEARTBEAT_THRESHOLD; + private final List _listeners = new ArrayList(); + private final Map _activePeers = new HashMap(); + private int _heartbeatInterval = ClusterManager.DEFAULT_HEARTBEAT_INTERVAL; + private int _heartbeatThreshold = ClusterManager.DEFAULT_HEARTBEAT_THRESHOLD; - private final Map clusterPeers; - private final Map asyncCalls; - private final Gson gson; + private final Map _clusterPeers; + private final Map _asyncCalls; + private final Gson _gson; @Inject private AgentManager _agentMgr; @@ -132,10 +132,10 @@ public class ClusterManagerImpl implements ClusterManager { public ClusterManagerImpl() { - clusterPeers = new HashMap(); - asyncCalls = new HashMap(); + _clusterPeers = new HashMap(); + _asyncCalls = new HashMap(); - gson = GsonHelper.getGson(); + _gson = GsonHelper.getGson(); // executor to perform remote-calls in another thread context, to avoid potential // recursive remote calls between nodes @@ -207,7 +207,7 @@ public class ClusterManagerImpl implements ClusterManager { public void broadcast(long agentId, Command[] cmds) { Date cutTime = DateUtil.currentGMTTime(); - List peers = _mshostDao.getActiveList(new Date(cutTime.getTime() - heartbeatThreshold)); + List peers = _mshostDao.getActiveList(new Date(cutTime.getTime() - _heartbeatThreshold)); for (ManagementServerHostVO peer : peers) { String peerName = Long.toString(peer.getMsid()); if (getSelfPeerName().equals(peerName)) { @@ -230,7 +230,7 @@ public class ClusterManagerImpl implements ClusterManager { if(s_logger.isDebugEnabled()) { s_logger.debug(getSelfPeerName() + " -> " + strPeer + "." + agentId + " " + - gson.toJson(cmds, Command[].class)); + _gson.toJson(cmds, Command[].class)); } for(int i = 0; i < 2; i++) { @@ -247,7 +247,7 @@ public class ClusterManagerImpl implements ClusterManager { } long startTick = System.currentTimeMillis(); - String strResult = peerService.execute(getSelfPeerName(), agentId, gson.toJson(cmds, Command[].class), stopOnError); + String strResult = peerService.execute(getSelfPeerName(), agentId, _gson.toJson(cmds, Command[].class), stopOnError); if(s_logger.isDebugEnabled()) { s_logger.debug("Completed " + getSelfPeerName() + " -> " + strPeer + "." + agentId + "in " + (System.currentTimeMillis() - startTick) + " ms, result: " + strResult); @@ -255,7 +255,7 @@ public class ClusterManagerImpl implements ClusterManager { if(strResult != null) { try { - return gson.fromJson(strResult, Answer[].class); + return _gson.fromJson(strResult, Answer[].class); } catch(Throwable e) { s_logger.error("Exception on parsing gson package from remote call to " + strPeer); } @@ -280,7 +280,7 @@ public class ClusterManagerImpl implements ClusterManager { if(s_logger.isDebugEnabled()) { s_logger.debug("Async " + getSelfPeerName() + " -> " + strPeer + "." + agentId + " " + - gson.toJson(cmds, Command[].class)); + _gson.toJson(cmds, Command[].class)); } for(int i = 0; i < 2; i++) { @@ -298,7 +298,7 @@ public class ClusterManagerImpl implements ClusterManager { } long startTick = System.currentTimeMillis(); - seq = peerService.executeAsync(getSelfPeerName(), agentId, gson.toJson(cmds, Command[].class), stopOnError); + seq = peerService.executeAsync(getSelfPeerName(), agentId, _gson.toJson(cmds, Command[].class), stopOnError); if(seq > 0) { if(s_logger.isDebugEnabled()) { s_logger.debug("Completed Async " + getSelfPeerName() + " -> " + strPeer + "." + agentId @@ -330,7 +330,7 @@ public class ClusterManagerImpl implements ClusterManager { public boolean onAsyncResult(String executingPeer, long agentId, long seq, Answer[] answers) { if(s_logger.isDebugEnabled()) { s_logger.debug("Process Async-call result from remote peer " + executingPeer + ", {" + - agentId + "-" + seq + "} answers: " + (answers != null ? gson.toJson(answers, Answer[].class): "null")); + agentId + "-" + seq + "} answers: " + (answers != null ? _gson.toJson(answers, Answer[].class): "null")); } Listener listener = null; @@ -381,7 +381,7 @@ public class ClusterManagerImpl implements ClusterManager { public boolean forwardAnswer(String targetPeer, long agentId, long seq, Answer[] answers) { if(s_logger.isDebugEnabled()) { s_logger.debug("Forward -> " + targetPeer + " Async-call answer {" + agentId + "-" + seq + - "} " + (answers != null? gson.toJson(answers, Answer[].class):"")); + "} " + (answers != null? _gson.toJson(answers, Answer[].class):"")); } final String targetPeerF = targetPeer; @@ -407,7 +407,7 @@ public class ClusterManagerImpl implements ClusterManager { s_logger.debug("Start forwarding Async-call answer {" + agentId + "-" + seq + "} to remote"); } - result = peerService.onAsyncResult(getSelfPeerName(), agentIdF, seqF, gson.toJson(answersF, Answer[].class)); + result = peerService.onAsyncResult(getSelfPeerName(), agentIdF, seqF, _gson.toJson(answersF, Answer[].class)); if(s_logger.isDebugEnabled()) { s_logger.debug("Completed forwarding Async-call answer {" + agentId + "-" + seq + "} in " + @@ -460,19 +460,19 @@ public class ClusterManagerImpl implements ClusterManager { @Override public void registerListener(ClusterManagerListener listener) { // Note : we don't check duplicates - synchronized (listeners) { + synchronized (_listeners) { s_logger.info("register cluster listener " + listener.getClass()); - listeners.add(listener); + _listeners.add(listener); } } @Override public void unregisterListener(ClusterManagerListener listener) { - synchronized(listeners) { + synchronized(_listeners) { s_logger.info("unregister cluster listener " + listener.getClass()); - listeners.remove(listener); + _listeners.remove(listener); } } @@ -485,8 +485,8 @@ public class ClusterManagerImpl implements ClusterManager { } } - synchronized(listeners) { - for(ClusterManagerListener listener : listeners) { + synchronized(_listeners) { + for(ClusterManagerListener listener : _listeners) { listener.onManagementNodeJoined(nodeList, _mshostId); } } @@ -504,8 +504,8 @@ public class ClusterManagerImpl implements ClusterManager { } } - synchronized(listeners) { - for(ClusterManagerListener listener : listeners) { + synchronized(_listeners) { + for(ClusterManagerListener listener : _listeners) { listener.onManagementNodeLeft(nodeList, _mshostId); } } @@ -518,28 +518,28 @@ public class ClusterManagerImpl implements ClusterManager { if(s_logger.isDebugEnabled()) s_logger.debug("Notify management server node isolation to listeners"); - synchronized(listeners) { - for(ClusterManagerListener listener : listeners) { + synchronized(_listeners) { + for(ClusterManagerListener listener : _listeners) { listener.onManagementNodeIsolated(); } } } public ClusterService getPeerService(String strPeer) throws RemoteException { - synchronized(clusterPeers) { - if(clusterPeers.containsKey(strPeer)) { - return clusterPeers.get(strPeer); + synchronized(_clusterPeers) { + if(_clusterPeers.containsKey(strPeer)) { + return _clusterPeers.get(strPeer); } } ClusterService service = _currentServiceAdapter.getPeerService(strPeer); if(service != null) { - synchronized(clusterPeers) { + synchronized(_clusterPeers) { // re-check the peer map again to deal with the // race conditions - if(!clusterPeers.containsKey(strPeer)) { - clusterPeers.put(strPeer, service); + if(!_clusterPeers.containsKey(strPeer)) { + _clusterPeers.put(strPeer, service); } } } @@ -548,9 +548,9 @@ public class ClusterManagerImpl implements ClusterManager { } public void invalidatePeerService(String strPeer) { - synchronized(clusterPeers) { - if(clusterPeers.containsKey(strPeer)) { - clusterPeers.remove(strPeer); + synchronized(_clusterPeers) { + if(_clusterPeers.containsKey(strPeer)) { + _clusterPeers.remove(strPeer); } } } @@ -558,9 +558,9 @@ public class ClusterManagerImpl implements ClusterManager { private void registerAsyncCall(String strPeer, long seq, Listener listener) { String key = strPeer + "/" + seq; - synchronized(asyncCalls) { - if(!asyncCalls.containsKey(key)) { - asyncCalls.put(key, listener); + synchronized(_asyncCalls) { + if(!_asyncCalls.containsKey(key)) { + _asyncCalls.put(key, listener); } } } @@ -568,9 +568,9 @@ public class ClusterManagerImpl implements ClusterManager { private Listener getAsyncCallListener(String strPeer, long seq) { String key = strPeer + "/" + seq; - synchronized(asyncCalls) { - if(asyncCalls.containsKey(key)) { - return asyncCalls.get(key); + synchronized(_asyncCalls) { + if(_asyncCalls.containsKey(key)) { + return _asyncCalls.get(key); } } @@ -580,9 +580,9 @@ public class ClusterManagerImpl implements ClusterManager { private void unregisterAsyncCall(String strPeer, long seq) { String key = strPeer + "/" + seq; - synchronized(asyncCalls) { - if(asyncCalls.containsKey(key)) { - asyncCalls.remove(key); + synchronized(_asyncCalls) { + if(_asyncCalls.containsKey(key)) { + _asyncCalls.remove(key); } } } @@ -781,7 +781,7 @@ public class ClusterManagerImpl implements ClusterManager { // upon startup, for all inactive management server nodes that we see at startup time, we will send notification also to help upper layer perform // missed cleanup Date cutTime = DateUtil.currentGMTTime(); - List inactiveList = _mshostDao.getInactiveList(new Date(cutTime.getTime() - heartbeatThreshold)); + List inactiveList = _mshostDao.getInactiveList(new Date(cutTime.getTime() - _heartbeatThreshold)); // We don't have foreign key constraints to enforce the mgmt_server_id integrity in host table, when user manually // remove records from mshost table, this will leave orphan mgmt_serve_id reference in host table. @@ -812,14 +812,14 @@ public class ClusterManagerImpl implements ClusterManager { private void peerScan() { Date cutTime = DateUtil.currentGMTTime(); - List currentList = _mshostDao.getActiveList(new Date(cutTime.getTime() - heartbeatThreshold)); + List currentList = _mshostDao.getActiveList(new Date(cutTime.getTime() - _heartbeatThreshold)); List removedNodeList = new ArrayList(); List invalidatedNodeList = new ArrayList(); if(_mshostId != null) { // only if we have already attached to cluster, will we start to check leaving nodes - for(Map.Entry entry : activePeers.entrySet()) { + for(Map.Entry entry : _activePeers.entrySet()) { ManagementServerHostVO current = getInListById(entry.getKey(), currentList); if(current == null) { @@ -853,7 +853,7 @@ public class ClusterManagerImpl implements ClusterManager { // process invalidated node list if(invalidatedNodeList.size() > 0) { for(ManagementServerHostVO mshost : invalidatedNodeList) { - activePeers.remove(mshost.getId()); + _activePeers.remove(mshost.getId()); try { JmxUtil.unregisterMBean("ClusterManager", "Node " + mshost.getId()); } catch(Exception e) { @@ -870,7 +870,7 @@ public class ClusterManagerImpl implements ClusterManager { ManagementServerHostVO mshost = it.next(); if(!pingManagementNode(mshost)) { s_logger.warn("Management node " + mshost.getId() + " is detected inactive by timestamp and also not pingable"); - activePeers.remove(mshost.getId()); + _activePeers.remove(mshost.getId()); try { JmxUtil.unregisterMBean("ClusterManager", "Node " + mshost.getId()); } catch(Exception e) { @@ -888,8 +888,8 @@ public class ClusterManagerImpl implements ClusterManager { List newNodeList = new ArrayList(); for(ManagementServerHostVO mshost : currentList) { - if(!activePeers.containsKey(mshost.getId())) { - activePeers.put(mshost.getId(), mshost); + if(!_activePeers.containsKey(mshost.getId())) { + _activePeers.put(mshost.getId(), mshost); if(s_logger.isDebugEnabled()) { s_logger.debug("Detected management node joined, id:" + mshost.getId() + ", nodeIP:" + mshost.getServiceIP()); @@ -970,7 +970,7 @@ public class ClusterManagerImpl implements ClusterManager { } // use seperate thread for heartbeat updates - _heartbeatScheduler.scheduleAtFixedRate(getHeartbeatTask(), heartbeatInterval, heartbeatInterval, TimeUnit.MILLISECONDS); + _heartbeatScheduler.scheduleAtFixedRate(getHeartbeatTask(), _heartbeatInterval, _heartbeatInterval, TimeUnit.MILLISECONDS); _notificationExecutor.submit(getNotificationTask()); } catch (Throwable e) { @@ -1048,12 +1048,12 @@ public class ClusterManagerImpl implements ClusterManager { String value = configs.get("cluster.heartbeat.interval"); if (value != null) { - heartbeatInterval = NumbersUtil.parseInt(value, ClusterManager.DEFAULT_HEARTBEAT_INTERVAL); + _heartbeatInterval = NumbersUtil.parseInt(value, ClusterManager.DEFAULT_HEARTBEAT_INTERVAL); } value = configs.get("cluster.heartbeat.threshold"); if (value != null) { - heartbeatThreshold = NumbersUtil.parseInt(value, ClusterManager.DEFAULT_HEARTBEAT_THRESHOLD); + _heartbeatThreshold = NumbersUtil.parseInt(value, ClusterManager.DEFAULT_HEARTBEAT_THRESHOLD); } File dbPropsFile = PropertiesUtil.findConfigFile("db.properties"); @@ -1125,7 +1125,7 @@ public class ClusterManagerImpl implements ClusterManager { public boolean isManagementNodeAlive(long msid) { ManagementServerHostVO mshost = _mshostDao.findByMsid(msid); if(mshost != null) { - if(mshost.getLastUpdateTime().getTime() >= DateUtil.currentGMTTime().getTime() - heartbeatThreshold) { + if(mshost.getLastUpdateTime().getTime() >= DateUtil.currentGMTTime().getTime() - _heartbeatThreshold) { return true; } } @@ -1178,20 +1178,20 @@ public class ClusterManagerImpl implements ClusterManager { @Override public int getHeartbeatThreshold() { - return this.heartbeatThreshold; + return this._heartbeatThreshold; } public int getHeartbeatInterval() { - return this.heartbeatInterval; + return this._heartbeatInterval; } public void setHeartbeatThreshold(int threshold) { - heartbeatThreshold = threshold; + _heartbeatThreshold = threshold; } private void checkConflicts() throws ConfigurationException { Date cutTime = DateUtil.currentGMTTime(); - List peers = _mshostDao.getActiveList(new Date(cutTime.getTime() - heartbeatThreshold)); + List peers = _mshostDao.getActiveList(new Date(cutTime.getTime() - _heartbeatThreshold)); for(ManagementServerHostVO peer : peers) { String peerIP = peer.getServiceIP().trim(); if(_clusterNodeIP.equals(peerIP)) {