You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/07/26 05:11:09 UTC
[6/8] git commit: updated refs/heads/master to 111febc
Moved ClusterManager into it's own package. Removed the agent load balancing code.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9aaa378b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9aaa378b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9aaa378b
Branch: refs/heads/master
Commit: 9aaa378b087271bf44f27ac9ca7f5ff8e9ec767f
Parents: 395cbcc
Author: Alex Huang <al...@citrix.com>
Authored: Thu Jul 25 18:59:30 2013 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Thu Jul 25 19:00:26 2013 -0700
----------------------------------------------------------------------
.../com/cloud/cluster/ManagementServerHost.java | 32 -
.../agent/api/ScheduleHostScanTaskCommand.java | 0
.../cluster/ClusterInvalidSessionException.java | 33 -
.../cluster/ManagementServerHostPeerVO.java | 120 --
.../cloud/cluster/ManagementServerHostVO.java | 182 ---
.../cluster/dao/ManagementServerHostDao.java | 48 -
.../dao/ManagementServerHostDaoImpl.java | 276 ----
.../dao/ManagementServerHostPeerDao.java | 27 -
.../dao/ManagementServerHostPeerDaoImpl.java | 108 --
framework/cluster/pom.xml | 28 +
.../cloud/cluster/ActiveFencingException.java | 30 +
.../com/cloud/cluster/ClusterFenceManager.java | 23 +
.../cloud/cluster/ClusterFenceManagerImpl.java | 58 +
.../cluster/ClusterInvalidSessionException.java | 32 +
.../src/com/cloud/cluster/ClusterManager.java | 58 +
.../com/cloud/cluster/ClusterManagerImpl.java | 1198 ++++++++++++++
.../cloud/cluster/ClusterManagerListener.java | 25 +
.../com/cloud/cluster/ClusterManagerMBean.java | 26 +
.../cloud/cluster/ClusterManagerMBeanImpl.java | 67 +
.../cloud/cluster/ClusterManagerMessage.java | 44 +
.../cloud/cluster/ClusterNodeJoinEventArgs.java | 43 +
.../cloud/cluster/ClusterNodeLeftEventArgs.java | 44 +
.../src/com/cloud/cluster/ClusterService.java | 25 +
.../cloud/cluster/ClusterServiceAdapter.java | 28 +
.../com/cloud/cluster/ClusterServicePdu.java | 112 ++
.../cloud/cluster/ClusterServiceRequestPdu.java | 54 +
.../cluster/ClusterServiceServletAdapter.java | 152 ++
.../cluster/ClusterServiceServletContainer.java | 179 +++
.../ClusterServiceServletHttpHandler.java | 192 +++
.../cluster/ClusterServiceServletImpl.java | 148 ++
.../com/cloud/cluster/ManagementServerHost.java | 34 +
.../cluster/ManagementServerHostPeerVO.java | 119 ++
.../cloud/cluster/ManagementServerHostVO.java | 182 +++
.../cloud/cluster/RemoteMethodConstants.java | 23 +
.../cluster/dao/ManagementServerHostDao.java | 48 +
.../dao/ManagementServerHostDaoImpl.java | 274 ++++
.../dao/ManagementServerHostPeerDao.java | 27 +
.../dao/ManagementServerHostPeerDaoImpl.java | 106 ++
framework/pom.xml | 2 +
server/pom.xml | 5 +
.../manager/ClusteredAgentManagerImpl.java | 343 +++-
.../com/cloud/async/AsyncJobManagerImpl.java | 8 +-
.../cloud/cluster/ActiveFencingException.java | 31 -
.../com/cloud/cluster/ClusterFenceManager.java | 23 -
.../cloud/cluster/ClusterFenceManagerImpl.java | 58 -
.../src/com/cloud/cluster/ClusterManager.java | 67 -
.../com/cloud/cluster/ClusterManagerImpl.java | 1517 ------------------
.../cloud/cluster/ClusterManagerListener.java | 25 -
.../com/cloud/cluster/ClusterManagerMBean.java | 27 -
.../cloud/cluster/ClusterManagerMBeanImpl.java | 67 -
.../cloud/cluster/ClusterManagerMessage.java | 44 -
.../cloud/cluster/ClusterNodeJoinEventArgs.java | 43 -
.../cloud/cluster/ClusterNodeLeftEventArgs.java | 44 -
.../src/com/cloud/cluster/ClusterService.java | 25 -
.../cloud/cluster/ClusterServiceAdapter.java | 28 -
.../com/cloud/cluster/ClusterServicePdu.java | 112 --
.../cloud/cluster/ClusterServiceRequestPdu.java | 54 -
.../cluster/ClusterServiceServletAdapter.java | 148 --
.../cluster/ClusterServiceServletContainer.java | 179 ---
.../ClusterServiceServletHttpHandler.java | 192 ---
.../cluster/ClusterServiceServletImpl.java | 146 --
.../cloud/cluster/DummyClusterManagerImpl.java | 179 ---
.../com/cloud/cluster/LockMasterListener.java | 49 -
.../cloud/cluster/RemoteMethodConstants.java | 23 -
.../com/cloud/server/LockMasterListener.java | 51 +
.../com/cloud/server/ManagementServerImpl.java | 3 +
66 files changed, 3758 insertions(+), 3940 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/api/src/com/cloud/cluster/ManagementServerHost.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/cluster/ManagementServerHost.java b/api/src/com/cloud/cluster/ManagementServerHost.java
deleted file mode 100644
index 9c88a2b..0000000
--- a/api/src/com/cloud/cluster/ManagementServerHost.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.cluster;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-public interface ManagementServerHost extends InternalIdentity {
-
- public static enum State {
- Up, Starting, Down
- };
-
- long getMsid();
-
- State getState();
-
- String getVersion();
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/core/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java b/core/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
old mode 100755
new mode 100644
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/engine/schema/src/com/cloud/cluster/ClusterInvalidSessionException.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/ClusterInvalidSessionException.java b/engine/schema/src/com/cloud/cluster/ClusterInvalidSessionException.java
deleted file mode 100644
index 8ac94f2..0000000
--- a/engine/schema/src/com/cloud/cluster/ClusterInvalidSessionException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.cluster;
-
-import com.cloud.exception.CloudException;
-
-public class ClusterInvalidSessionException extends CloudException {
-
- private static final long serialVersionUID = -6636524194520997512L;
-
- public ClusterInvalidSessionException(String message) {
- super(message);
- }
-
- public ClusterInvalidSessionException(String message, Throwable th) {
- super(message, th);
- }
-}
-
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/engine/schema/src/com/cloud/cluster/ManagementServerHostPeerVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/ManagementServerHostPeerVO.java b/engine/schema/src/com/cloud/cluster/ManagementServerHostPeerVO.java
deleted file mode 100644
index e5e12ec..0000000
--- a/engine/schema/src/com/cloud/cluster/ManagementServerHostPeerVO.java
+++ /dev/null
@@ -1,120 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.cluster;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import com.cloud.utils.DateUtil;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="mshost_peer")
-public class ManagementServerHostPeerVO implements InternalIdentity {
-
- @Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- @Column(name="id")
- private long id;
-
- @Column(name="owner_mshost", updatable=true, nullable=false)
- private long ownerMshost;
-
- @Column(name="peer_mshost", updatable=true, nullable=false)
- private long peerMshost;
-
- @Column(name="peer_runid", updatable=true, nullable=false)
- private long peerRunid;
-
- @Column(name="peer_state", updatable = true, nullable=false)
- @Enumerated(value=EnumType.STRING)
- private ManagementServerHost.State peerState;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="last_update", updatable=true, nullable=true)
- private Date lastUpdateTime;
-
- public ManagementServerHostPeerVO() {
- }
-
- public ManagementServerHostPeerVO(long ownerMshost, long peerMshost, long peerRunid, ManagementServerHost.State peerState) {
- this.ownerMshost = ownerMshost;
- this.peerMshost = peerMshost;
- this.peerRunid = peerRunid;
- this.peerState = peerState;
-
- this.lastUpdateTime = DateUtil.currentGMTTime();
- }
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public long getOwnerMshost() {
- return ownerMshost;
- }
-
- public void setOwnerMshost(long ownerMshost) {
- this.ownerMshost = ownerMshost;
- }
-
- public long getPeerMshost() {
- return peerMshost;
- }
-
- public void setPeerMshost(long peerMshost) {
- this.peerMshost = peerMshost;
- }
-
- public long getPeerRunid() {
- return peerRunid;
- }
-
- public void setPeerRunid(long peerRunid) {
- this.peerRunid = peerRunid;
- }
-
- public ManagementServerHost.State getPeerState() {
- return peerState;
- }
-
- public void setPeerState(ManagementServerHost.State peerState) {
- this.peerState = peerState;
- }
-
- public Date getLastUpdateTime() {
- return lastUpdateTime;
- }
-
- public void setLastUpdateTime(Date lastUpdateTime) {
- this.lastUpdateTime = lastUpdateTime;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/engine/schema/src/com/cloud/cluster/ManagementServerHostVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/ManagementServerHostVO.java b/engine/schema/src/com/cloud/cluster/ManagementServerHostVO.java
deleted file mode 100644
index 31642e4..0000000
--- a/engine/schema/src/com/cloud/cluster/ManagementServerHostVO.java
+++ /dev/null
@@ -1,182 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.cluster;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="mshost")
-public class ManagementServerHostVO implements ManagementServerHost {
-
- @Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- @Column(name="id")
- private long id;
-
- @Column(name="msid", updatable=true, nullable=false)
- private long msid;
-
- @Column(name="runid", updatable=true, nullable=false)
- private long runid;
-
- @Column(name="name", updatable=true, nullable=true)
- private String name;
-
- @Column(name="state", updatable = true, nullable=false)
- @Enumerated(value=EnumType.STRING)
- private ManagementServerHost.State state;
-
- @Column(name="version", updatable=true, nullable=true)
- private String version;
-
- @Column(name="service_ip", updatable=true, nullable=false)
- private String serviceIP;
-
- @Column(name="service_port", updatable=true, nullable=false)
- private int servicePort;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="last_update", updatable=true, nullable=true)
- private Date lastUpdateTime;
-
- @Column(name=GenericDao.REMOVED_COLUMN)
- private Date removed;
-
- @Column(name="alert_count", updatable=true, nullable=false)
- private int alertCount;
-
- public ManagementServerHostVO() {
- }
-
- public ManagementServerHostVO(long msid, long runid, String serviceIP, int servicePort, Date updateTime) {
- this.msid = msid;
- this.runid = runid;
- this.serviceIP = serviceIP;
- this.servicePort = servicePort;
- this.lastUpdateTime = updateTime;
- }
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public long getRunid() {
- return runid;
- }
-
- public void setRunid(long runid) {
- this.runid = runid;
- }
-
- @Override
- public long getMsid() {
- return msid;
- }
-
- public void setMsid(long msid) {
- this.msid = msid;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public ManagementServerHost.State getState() {
- return this.state;
- }
-
- public void setState(ManagementServerHost.State state) {
- this.state = state;
- }
-
- @Override
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getServiceIP() {
- return serviceIP;
- }
-
- public void setServiceIP(String serviceIP) {
- this.serviceIP = serviceIP;
- }
-
- public int getServicePort() {
- return servicePort;
- }
-
- public void setServicePort(int servicePort) {
- this.servicePort = servicePort;
- }
-
- public Date getLastUpdateTime() {
- return lastUpdateTime;
- }
-
- public void setLastUpdateTime(Date lastUpdateTime) {
- this.lastUpdateTime = lastUpdateTime;
- }
-
- public Date getRemoved() {
- return removed;
- }
-
- public void setRemoved(Date removedTime) {
- removed = removedTime;
- }
-
- public int getAlertCount() {
- return alertCount;
- }
-
- public void setAlertCount(int count) {
- alertCount = count;
- }
-
- @Override
- public String toString() {
- return new StringBuilder("ManagementServer[").append("-").append(id).append("-").append(msid).append("-").append(state).append("]").toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDao.java b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDao.java
deleted file mode 100644
index fec0679..0000000
--- a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDao.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.cluster.dao;
-
-import java.util.Date;
-import java.util.List;
-
-import com.cloud.cluster.ManagementServerHost;
-import com.cloud.cluster.ManagementServerHost.State;
-import com.cloud.cluster.ManagementServerHostVO;
-import com.cloud.utils.db.Filter;
-import com.cloud.utils.db.GenericDao;
-
-public interface ManagementServerHostDao extends GenericDao<ManagementServerHostVO, Long> {
- @Override
- boolean remove(Long id);
-
- ManagementServerHostVO findByMsid(long msid);
- int increaseAlertCount(long id);
-
- void update(long id, long runid, String name, String version, String serviceIP, int servicePort, Date lastUpdate);
- void update(long id, long runid, Date lastUpdate);
- List<ManagementServerHostVO> getActiveList(Date cutTime);
- List<ManagementServerHostVO> getInactiveList(Date cutTime);
-
- void invalidateRunSession(long id, long runid);
-
- void update(long id, long runId, State state, Date lastUpdate);
-
- List<ManagementServerHostVO> listBy(ManagementServerHost.State...states);
- public List<Long> listOrphanMsids();
-
- ManagementServerHostVO findOneInUpState(Filter filter);
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
deleted file mode 100644
index 3866da1..0000000
--- a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
+++ /dev/null
@@ -1,276 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.cluster.dao;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.TimeZone;
-
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import com.cloud.cluster.ClusterInvalidSessionException;
-import com.cloud.cluster.ManagementServerHost;
-import com.cloud.cluster.ManagementServerHost.State;
-import com.cloud.cluster.ManagementServerHostVO;
-import com.cloud.utils.DateUtil;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.Filter;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@Component
-@Local(value={ManagementServerHostDao.class})
-public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServerHostVO, Long> implements ManagementServerHostDao {
- private static final Logger s_logger = Logger.getLogger(ManagementServerHostDaoImpl.class);
-
- private final SearchBuilder<ManagementServerHostVO> MsIdSearch;
- private final SearchBuilder<ManagementServerHostVO> ActiveSearch;
- private final SearchBuilder<ManagementServerHostVO> InactiveSearch;
- private final SearchBuilder<ManagementServerHostVO> StateSearch;
-
- @Override
- public void invalidateRunSession(long id, long runid) {
- Transaction txn = Transaction.currentTxn();
- PreparedStatement pstmt = null;
- try {
- pstmt = txn.prepareAutoCloseStatement("update mshost set runid=0, state='Down' where id=? and runid=?");
- pstmt.setLong(1, id);
- pstmt.setLong(2, runid);
-
- pstmt.executeUpdate();
- } catch (SQLException e) {
- throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
- }
- }
-
- @Override
- public ManagementServerHostVO findByMsid(long msid) {
- SearchCriteria<ManagementServerHostVO> sc = MsIdSearch.create();
- sc.setParameters("msid", msid);
-
- List<ManagementServerHostVO> l = listIncludingRemovedBy(sc);
- if(l != null && l.size() > 0) {
- return l.get(0);
- }
-
- return null;
- }
-
- @Override
- @DB
- public void update(long id, long runid, String name, String version, String serviceIP, int servicePort, Date lastUpdate) {
- Transaction txn = Transaction.currentTxn();
- PreparedStatement pstmt = null;
- try {
- txn.start();
-
- pstmt = txn.prepareAutoCloseStatement("update mshost set name=?, version=?, service_ip=?, service_port=?, last_update=?, removed=null, alert_count=0, runid=?, state=? where id=?");
- pstmt.setString(1, name);
- pstmt.setString(2, version);
- pstmt.setString(3, serviceIP);
- pstmt.setInt(4, servicePort);
- pstmt.setString(5, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), lastUpdate));
- pstmt.setLong(6, runid);
- pstmt.setString(7, ManagementServerHost.State.Up.toString());
- pstmt.setLong(8, id);
-
- pstmt.executeUpdate();
- txn.commit();
- } catch(Exception e) {
- s_logger.warn("Unexpected exception, ", e);
- }
- }
-
- @Override
- @DB
- public boolean remove(Long id) {
- Transaction txn = Transaction.currentTxn();
-
- try {
- txn.start();
-
- ManagementServerHostVO msHost = findById(id);
- msHost.setState(ManagementServerHost.State.Down);
- super.remove(id);
-
- txn.commit();
- return true;
- } catch(Exception e) {
- s_logger.warn("Unexpected exception, ", e);
- }
-
- return false;
- }
-
- @Override
- @DB
- public void update(long id, long runid, Date lastUpdate) {
- Transaction txn = Transaction.currentTxn();
- PreparedStatement pstmt = null;
- try {
- txn.start();
-
- pstmt = txn.prepareAutoCloseStatement("update mshost set last_update=?, removed=null, alert_count=0 where id=? and runid=?");
- pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), lastUpdate));
- pstmt.setLong(2, id);
- pstmt.setLong(3, runid);
-
- int count = pstmt.executeUpdate();
- txn.commit();
-
- if(count < 1) {
- throw new CloudRuntimeException("Invalid cluster session detected", new ClusterInvalidSessionException("runid " + runid + " is no longer valid"));
- }
- } catch(Exception e) {
- s_logger.warn("Unexpected exception, ", e);
- }
- }
-
- @Override
- public List<ManagementServerHostVO> getActiveList(Date cutTime) {
- SearchCriteria<ManagementServerHostVO> sc = ActiveSearch.create();
- sc.setParameters("lastUpdateTime", cutTime);
-
- return listIncludingRemovedBy(sc);
- }
-
- @Override
- public List<ManagementServerHostVO> getInactiveList(Date cutTime) {
- SearchCriteria<ManagementServerHostVO> sc = InactiveSearch.create();
- sc.setParameters("lastUpdateTime", cutTime);
-
- return listIncludingRemovedBy(sc);
- }
-
- @Override
- @DB
- public int increaseAlertCount(long id) {
- Transaction txn = Transaction.currentTxn();
- PreparedStatement pstmt = null;
- int changedRows = 0;
- try {
- txn.start();
-
- pstmt = txn.prepareAutoCloseStatement("update mshost set alert_count=alert_count+1 where id=? and alert_count=0");
- pstmt.setLong(1, id);
-
- changedRows = pstmt.executeUpdate();
- txn.commit();
- } catch(Exception e) {
- s_logger.warn("Unexpected exception, ", e);
- txn.rollback();
- }
-
- return changedRows;
- }
-
- protected ManagementServerHostDaoImpl() {
- MsIdSearch = createSearchBuilder();
- MsIdSearch.and("msid", MsIdSearch.entity().getMsid(), SearchCriteria.Op.EQ);
- MsIdSearch.done();
-
- ActiveSearch = createSearchBuilder();
- ActiveSearch.and("lastUpdateTime", ActiveSearch.entity().getLastUpdateTime(), SearchCriteria.Op.GT);
- ActiveSearch.and("removed", ActiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
- ActiveSearch.done();
-
- InactiveSearch = createSearchBuilder();
- InactiveSearch.and("lastUpdateTime", InactiveSearch.entity().getLastUpdateTime(), SearchCriteria.Op.LTEQ);
- InactiveSearch.and("removed", InactiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
- InactiveSearch.done();
-
- StateSearch = createSearchBuilder();
- StateSearch.and("state", StateSearch.entity().getState(), SearchCriteria.Op.IN);
- StateSearch.done();
- }
-
-
- @Override
- public void update(long id, long runId, State state, Date lastUpdate) {
- Transaction txn = Transaction.currentTxn();
- PreparedStatement pstmt = null;
- try {
- pstmt = txn.prepareAutoCloseStatement("update mshost set state=?, last_update=? where id=? and runid=?");
- pstmt.setString(1, state.toString());
- pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), lastUpdate));
- pstmt.setLong(3, id);
- pstmt.setLong(4, runId);
-
- int count = pstmt.executeUpdate();
-
- if(count < 1) {
- throw new CloudRuntimeException("Invalid cluster session detected", new ClusterInvalidSessionException("runid " + runId + " is no longer valid"));
- }
- } catch (SQLException e) {
- throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
- }
- }
-
- @Override
- public List<ManagementServerHostVO> listBy(ManagementServerHost.State...states) {
- SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
-
- sc.setParameters("state", (Object[]) states);
-
- return listBy(sc);
- }
-
- @Override
- public List<Long> listOrphanMsids() {
- List<Long> orphanList = new ArrayList<Long>();
-
- Transaction txn = Transaction.currentTxn();
- PreparedStatement pstmt = null;
- try {
- pstmt = txn.prepareAutoCloseStatement(
- "select t.mgmt_server_id from (select mgmt_server_id, count(*) as count from host group by mgmt_server_id) as t WHERE t.count > 0 AND t.mgmt_server_id NOT IN (select msid from mshost)");
-
- ResultSet rs = pstmt.executeQuery();
- while(rs.next()) {
- orphanList.add(rs.getLong(1));
- }
- } catch (SQLException e) {
- throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
- }
-
- return orphanList;
- }
-
- @Override
- public ManagementServerHostVO findOneInUpState(Filter filter) {
- SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
-
- sc.setParameters("state", ManagementServerHost.State.Up);
-
- List<ManagementServerHostVO> mshosts = listBy(sc, filter);
- if(mshosts != null && mshosts.size() > 0){
- return mshosts.get(0);
- }
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDao.java b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDao.java
deleted file mode 100644
index 14c872a..0000000
--- a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDao.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.cluster.dao;
-
-import com.cloud.cluster.ManagementServerHost;
-import com.cloud.cluster.ManagementServerHostPeerVO;
-import com.cloud.utils.db.GenericDao;
-
-public interface ManagementServerHostPeerDao extends GenericDao<ManagementServerHostPeerVO, Long> {
- void clearPeerInfo(long ownerMshost);
- void updatePeerInfo(long ownerMshost, long peerMshost, long peerRunid, ManagementServerHost.State peerState);
- int countStateSeenInPeers(long mshost, long runid, ManagementServerHost.State state);
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java
deleted file mode 100644
index 8ad02cd..0000000
--- a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java
+++ /dev/null
@@ -1,108 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.cluster.dao;
-
-import java.util.List;
-
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import com.cloud.cluster.ManagementServerHost;
-import com.cloud.cluster.ManagementServerHostPeerVO;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-
-@Component
-@Local(value={ManagementServerHostPeerDao.class})
-public class ManagementServerHostPeerDaoImpl extends GenericDaoBase<ManagementServerHostPeerVO, Long> implements ManagementServerHostPeerDao {
- private static final Logger s_logger = Logger.getLogger(ManagementServerHostPeerDaoImpl.class);
-
- private final SearchBuilder<ManagementServerHostPeerVO> ClearPeerSearch;
- private final SearchBuilder<ManagementServerHostPeerVO> FindForUpdateSearch;
- private final SearchBuilder<ManagementServerHostPeerVO> CountSearch;
-
- public ManagementServerHostPeerDaoImpl() {
- ClearPeerSearch = createSearchBuilder();
- ClearPeerSearch.and("ownerMshost", ClearPeerSearch.entity().getOwnerMshost(), SearchCriteria.Op.EQ);
- ClearPeerSearch.done();
-
- FindForUpdateSearch = createSearchBuilder();
- FindForUpdateSearch.and("ownerMshost", FindForUpdateSearch.entity().getOwnerMshost(), SearchCriteria.Op.EQ);
- FindForUpdateSearch.and("peerMshost", FindForUpdateSearch.entity().getPeerMshost(), SearchCriteria.Op.EQ);
- FindForUpdateSearch.and("peerRunid", FindForUpdateSearch.entity().getPeerRunid(), SearchCriteria.Op.EQ);
- FindForUpdateSearch.done();
-
- CountSearch = createSearchBuilder();
- CountSearch.and("peerMshost", CountSearch.entity().getPeerMshost(), SearchCriteria.Op.EQ);
- CountSearch.and("peerRunid", CountSearch.entity().getPeerRunid(), SearchCriteria.Op.EQ);
- CountSearch.and("peerState", CountSearch.entity().getPeerState(), SearchCriteria.Op.EQ);
- CountSearch.done();
- }
-
- @Override
- @DB
- public void clearPeerInfo(long ownerMshost) {
- SearchCriteria<ManagementServerHostPeerVO> sc = ClearPeerSearch.create();
- sc.setParameters("ownerMshost", ownerMshost);
-
- expunge(sc);
- }
-
- @Override
- @DB
- public void updatePeerInfo(long ownerMshost, long peerMshost, long peerRunid, ManagementServerHost.State peerState) {
- Transaction txn = Transaction.currentTxn();
- try {
- txn.start();
-
- SearchCriteria<ManagementServerHostPeerVO> sc = FindForUpdateSearch.create();
- sc.setParameters("ownerMshost", ownerMshost);
- sc.setParameters("peerMshost", peerMshost);
- sc.setParameters("peerRunid", peerRunid);
- List<ManagementServerHostPeerVO> l = listBy(sc);
- if(l.size() == 1) {
- ManagementServerHostPeerVO peer = l.get(0);
- peer.setPeerState(peerState);
- update(peer.getId(), peer);
- } else {
- ManagementServerHostPeerVO peer = new ManagementServerHostPeerVO(ownerMshost, peerMshost, peerRunid, peerState);
- persist(peer);
- }
- txn.commit();
- } catch(Exception e) {
- s_logger.warn("Unexpected exception, ", e);
- txn.rollback();
- }
- }
-
- @Override
- @DB
- public int countStateSeenInPeers(long mshost, long runid, ManagementServerHost.State state) {
- SearchCriteria<ManagementServerHostPeerVO> sc = CountSearch.create();
- sc.setParameters("peerMshost", mshost);
- sc.setParameters("peerRunid", runid);
- sc.setParameters("peerState", state);
-
- List<ManagementServerHostPeerVO> l = listBy(sc);
- return l.size();
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/framework/cluster/pom.xml
----------------------------------------------------------------------
diff --git a/framework/cluster/pom.xml b/framework/cluster/pom.xml
new file mode 100644
index 0000000..116b635
--- /dev/null
+++ b/framework/cluster/pom.xml
@@ -0,0 +1,28 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (the "License"); you may not use this file except
+ in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software distributed under
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. See the License for the specific language
+ governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>cloud-framework-cluster</artifactId>
+ <name>Apache CloudStack Framework - Clustering</name>
+ <parent>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloudstack-framework</artifactId>
+ <version>4.2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/framework/cluster/src/com/cloud/cluster/ActiveFencingException.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ActiveFencingException.java b/framework/cluster/src/com/cloud/cluster/ActiveFencingException.java
new file mode 100644
index 0000000..a445086
--- /dev/null
+++ b/framework/cluster/src/com/cloud/cluster/ActiveFencingException.java
@@ -0,0 +1,30 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.cluster;
+
+
+public class ActiveFencingException extends Exception {
+ private static final long serialVersionUID = -3975376101728211726L;
+
+ public ActiveFencingException(String message) {
+ super(message);
+ }
+
+ public ActiveFencingException(String message, Throwable th) {
+ super(message, th);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/framework/cluster/src/com/cloud/cluster/ClusterFenceManager.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterFenceManager.java b/framework/cluster/src/com/cloud/cluster/ClusterFenceManager.java
new file mode 100644
index 0000000..b9782ad
--- /dev/null
+++ b/framework/cluster/src/com/cloud/cluster/ClusterFenceManager.java
@@ -0,0 +1,23 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.cluster;
+
+import com.cloud.utils.component.Manager;
+
+public interface ClusterFenceManager extends Manager {
+ public static final int SELF_FENCING_EXIT_CODE = 219;
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/framework/cluster/src/com/cloud/cluster/ClusterFenceManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterFenceManagerImpl.java b/framework/cluster/src/com/cloud/cluster/ClusterFenceManagerImpl.java
new file mode 100644
index 0000000..7e4922e
--- /dev/null
+++ b/framework/cluster/src/com/cloud/cluster/ClusterFenceManagerImpl.java
@@ -0,0 +1,58 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.cluster;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.component.ManagerBase;
+
+
+@Component
+@Local(value={ClusterFenceManager.class})
+public class ClusterFenceManagerImpl extends ManagerBase implements ClusterFenceManager, ClusterManagerListener {
+ private static final Logger s_logger = Logger.getLogger(ClusterFenceManagerImpl.class);
+
+ @Inject ClusterManager _clusterMgr;
+
+ @Override
+ public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+ _clusterMgr.registerListener(this);
+ return true;
+ }
+
+ @Override
+ public void onManagementNodeJoined(List<ManagementServerHostVO> nodeList, long selfNodeId) {
+ }
+
+ @Override
+ public void onManagementNodeLeft(List<ManagementServerHostVO> nodeList, long selfNodeId) {
+ }
+
+ @Override
+ public void onManagementNodeIsolated() {
+ s_logger.error("Received node isolation notification, will perform self-fencing and shut myself down");
+ System.exit(SELF_FENCING_EXIT_CODE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/framework/cluster/src/com/cloud/cluster/ClusterInvalidSessionException.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterInvalidSessionException.java b/framework/cluster/src/com/cloud/cluster/ClusterInvalidSessionException.java
new file mode 100644
index 0000000..e9378b7
--- /dev/null
+++ b/framework/cluster/src/com/cloud/cluster/ClusterInvalidSessionException.java
@@ -0,0 +1,32 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.cluster;
+
+
+public class ClusterInvalidSessionException extends Exception {
+
+ private static final long serialVersionUID = -6636524194520997512L;
+
+ public ClusterInvalidSessionException(String message) {
+ super(message);
+ }
+
+ public ClusterInvalidSessionException(String message, Throwable th) {
+ super(message, th);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aaa378b/framework/cluster/src/com/cloud/cluster/ClusterManager.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManager.java b/framework/cluster/src/com/cloud/cluster/ClusterManager.java
new file mode 100644
index 0000000..51d993e
--- /dev/null
+++ b/framework/cluster/src/com/cloud/cluster/ClusterManager.java
@@ -0,0 +1,58 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.cluster;
+
+import com.cloud.utils.component.Manager;
+
+public interface ClusterManager extends Manager {
+ static final String ALERT_SUBJECT = "cluster-alert";
+
+ void OnReceiveClusterServicePdu(ClusterServicePdu pdu);
+
+ /**
+ * This executes
+ * @param strPeer
+ * @param agentId
+ * @param cmds
+ * @param stopOnError
+ * @return
+ */
+ String execute(String strPeer, long agentId, String cmds, boolean stopOnError);
+
+ /**
+ * Broadcast the command to all of the management server nodes.
+ * @param agentId agent id this broadcast is regarding
+ * @param cmds commands to broadcast
+ */
+ void broadcast(long agentId, String cmds);
+
+ int getHeartbeatThreshold();
+
+ void registerListener(ClusterManagerListener listener);
+ void unregisterListener(ClusterManagerListener listener);
+
+ void registerDispatcher(Dispatcher dispatcher);
+
+ ManagementServerHost getPeer(String peerName);
+
+ String getSelfPeerName();
+
+ public interface Dispatcher {
+ String getName();
+ String dispatch(ClusterServicePdu pdu);
+ }
+}