Search in sources :

Example 6 with DbProcessStatusInfo

use of com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo in project cubrid-manager by CUBRID.

the class HAUtil method getActiveCopyLogDbProcessStatusInfo.

/**
	 * 
	 * Get the Copy Log DB process status information of active node from
	 * standby node
	 * 
	 * @param dbNode DatabaseNode
	 * @return DbProcessStatusInfo
	 */
public static DbProcessStatusInfo getActiveCopyLogDbProcessStatusInfo(DatabaseNode dbNode) {
    HADatabaseStatusInfo dbStatusInfo = dbNode.getHaDatabaseStatus();
    if (dbStatusInfo == null) {
        return null;
    }
    DBStatusType dbStatusType = dbStatusInfo.getStatusType();
    if (dbStatusType != DBStatusType.STANDBY && dbStatusType != DBStatusType.MAINTENANCE) {
        return null;
    }
    List<DbProcessStatusInfo> dbProcessList = dbStatusInfo.getCopyLogDbProcessStatusList();
    if (dbProcessList == null || dbProcessList.isEmpty()) {
        return null;
    }
    HAHostStatusInfo hostStatusInfo = dbNode.getParent().getHostStatusInfo();
    if (hostStatusInfo.getStatusType() != HostStatusType.SLAVE && hostStatusInfo.getStatusType() != HostStatusType.REPLICA) {
        return null;
    }
    HAHostStatusInfo masterHostStatusInfo = hostStatusInfo.getMasterHostStatusInfo();
    if (masterHostStatusInfo == null) {
        return null;
    }
    String masterHostName = masterHostStatusInfo.getHostName();
    for (DbProcessStatusInfo processStatusInfo : dbProcessList) {
        if (masterHostName.equals(processStatusInfo.getHostName())) {
            return processStatusInfo;
        }
    }
    return null;
}
Also used : HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) DBStatusType(com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType) DbProcessStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)

Aggregations

DbProcessStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo)6 HADatabaseStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)4 TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)2 DBStatusType (com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType)2 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)2