use of com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult in project cubrid-manager by CUBRID.
the class DatabaseDashboardViewPart method performUpdate.
/**
* Perform the update data
*
* @param dataChangedEvent the given event including newest data
*/
public void performUpdate(DataChangedEvent dataChangedEvent) {
if (composite == null || composite.isDisposed()) {
return;
}
if (dbNode.getParent().isConnected()) {
HADatabaseStatusInfo haDbStatusInfo = HAUtil.getDatabaseStatusInfo(dataChangedEvent.getHaHostStatusInfoList(), dbNode.getParent().getIp(), dbNode.getDbName());
if (haDbStatusInfo == null) {
haDbStatusInfo = HAUtil.getDatabaseStatusInfo(dataChangedEvent.getDbStatusInfoList(), dbNode.getDbName());
if (null == haDbStatusInfo) {
haDbStatusInfo = new HADatabaseStatusInfo();
haDbStatusInfo.setDbName(dbNode.getDbName());
}
}
dbNode.setHaDatabaseStatus(haDbStatusInfo);
} else {
HADatabaseStatusInfo haDatabaseStatus = new HADatabaseStatusInfo();
haDatabaseStatus.setDbName(dbNode.getDbName());
dbNode.setHaDatabaseStatus(haDatabaseStatus);
}
Set<MondashDataResult> set = dataChangedEvent.getResultSet();
Map<IDiagPara, String> updateMap = null;
String hostCpuTotal = "0";
String hostMemTotal = "0";
for (MondashDataResult result : set) {
if (dbNode.getDbName().equals(result.getName())) {
updateMap = result.getUpdateMap();
} else if (generator.getName().equals(result.getName())) {
Map<IDiagPara, String> hostMap = result.getUpdateMap();
if (hostMap != null) {
hostCpuTotal = hostMap.get(HostStatEnum.CPU_TOTAL);
hostCpuTotal = hostCpuTotal == null ? "0" : hostCpuTotal;
hostMemTotal = hostMap.get(HostStatEnum.MEMPHY_TOTAL);
hostMemTotal = hostMemTotal == null ? "0" : hostMemTotal;
}
}
}
performUpdate(updateMap, hostCpuTotal, hostMemTotal);
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult in project cubrid-manager by CUBRID.
the class DatabaseMonitorPartHelper method performUpdate.
/**
* Perform the update data
*
* @param dataChangedEvent the given event including newest data
*/
public void performUpdate(DataChangedEvent dataChangedEvent) {
if (!dbNode.getParent().isConnected()) {
HADatabaseStatusInfo haDatabaseStatus = new HADatabaseStatusInfo();
haDatabaseStatus.setDbName(dbNode.getDbName());
dbNode.setHaDatabaseStatus(haDatabaseStatus);
return;
}
Set<MondashDataResult> set = dataChangedEvent.getResultSet();
String dbName = dbNode.getDbName();
Map<IDiagPara, String> updateMap = null;
String hostCpuTotal = null;
String hostMemTotal = null;
for (MondashDataResult result : set) {
if (dbName.equals(result.getName())) {
updateMap = result.getUpdateMap();
} else if (generator.getName().equals(result.getName())) {
Map<IDiagPara, String> hostMap = result.getUpdateMap();
if (hostMap != null) {
hostCpuTotal = hostMap.get(HostStatEnum.CPU_TOTAL);
hostMemTotal = hostMap.get(HostStatEnum.MEMPHY_TOTAL);
}
}
}
int[] value = getValues(updateMap, hostCpuTotal == null ? "0" : hostCpuTotal, hostMemTotal == null ? "0" : hostMemTotal);
HADatabaseStatusInfo haDbStatusInfo = HAUtil.getDatabaseStatusInfo(dataChangedEvent.getHaHostStatusInfoList(), dbNode.getParent().getIp(), dbNode.getDbName());
if (haDbStatusInfo == null) {
haDbStatusInfo = HAUtil.getDatabaseStatusInfo(dataChangedEvent.getDbStatusInfoList(), dbNode.getDbName());
if (null == haDbStatusInfo) {
haDbStatusInfo = new HADatabaseStatusInfo();
haDbStatusInfo.setDbName(dbNode.getDbName());
}
}
haDbStatusInfo.setCpuUsage(value[0]);
haDbStatusInfo.setMemUsage(value[1]);
haDbStatusInfo.setDelay(value[2]);
dbNode.setHaDatabaseStatus(haDbStatusInfo);
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult in project cubrid-manager by CUBRID.
the class HostMonitorPartHelper method performUpdate.
/**
* Perform the update data
*
* @param dataChangedEvent the given event including newest data
*/
public void performUpdate(DataChangedEvent dataChangedEvent) {
DataProvider dataProvider = (DataProvider) dataChangedEvent.getSource();
if (dataProvider != null && dataProvider.getServerInfo() != null) {
hostNode.setConnected(dataProvider.getServerInfo().isConnected());
}
if (!hostNode.isConnected()) {
hostNode.setConnected(false);
HAHostStatusInfo haHostStatusInfo = new HAHostStatusInfo();
haHostStatusInfo.setIp(hostNode.getIp());
hostNode.setHostStatusInfo(haHostStatusInfo);
return;
}
HAHostStatusInfo haHostStatusInfo = HAUtil.getHostStatusInfo(dataChangedEvent.getHaHostStatusInfoList(), hostNode.getIp());
if (haHostStatusInfo == null) {
haHostStatusInfo = HAUtil.getHAHostStatusInfo(hostNode.getServerInfo());
if (haHostStatusInfo == null) {
haHostStatusInfo = new HAHostStatusInfo();
haHostStatusInfo.setIp(hostNode.getIp());
}
}
Set<MondashDataResult> set = dataChangedEvent.getResultSet();
Map<IDiagPara, String> map = null;
for (MondashDataResult result : set) {
if (generator.getName().equals(result.getName())) {
map = result.getUpdateMap();
break;
}
}
int[] value = getValues(map);
haHostStatusInfo.setCpuUsage(value[0]);
haHostStatusInfo.setMemUsage(value[1]);
haHostStatusInfo.setIoWait(value[2]);
hostNode.setHostStatusInfo(haHostStatusInfo);
}
Aggregations