Search in sources :

Example 6 with DataProvider

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);
}
Also used : DataProvider(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataProvider) HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) MondashDataResult(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult) IDiagPara(com.cubrid.cubridmanager.core.monitoring.model.IDiagPara)

Example 7 with DataProvider

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);
}
Also used : DataProvider(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataProvider) DataGeneratorPool(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataGeneratorPool)

Aggregations

DataProvider (com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataProvider)7 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)4 DataGeneratorPool (com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataGeneratorPool)3 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)2 ArrayList (java.util.ArrayList)2 IPath (org.eclipse.core.runtime.IPath)2 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)1 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)1 BrokerDiagEnum (com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagEnum)1 DbProcStatEnum (com.cubrid.cubridmanager.core.monitoring.model.DbProcStatEnum)1 DbStatDumpEnum (com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpEnum)1 HostStatEnum (com.cubrid.cubridmanager.core.monitoring.model.HostStatEnum)1 IDiagPara (com.cubrid.cubridmanager.core.monitoring.model.IDiagPara)1 StandbyServerStatEnum (com.cubrid.cubridmanager.core.monitoring.model.StandbyServerStatEnum)1 MondashDataResult (com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult)1