use of com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataProvider 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);
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataProvider in project cubrid-manager by CUBRID.
the class HostMonitorPartHelper method active.
/**
*
* Active this listener
*
*/
public void active() {
if (hostNode == null) {
return;
}
DataGeneratorPool pool = DataGeneratorPool.getInstance();
String generatorName = hostNode.getUserName() + "@" + hostNode.getIp() + ":" + hostNode.getPort();
generator = pool.getDataGenerator(generatorName, new DataProvider());
generator.addDataUpdateListener(this);
}
Aggregations