use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.helper.HostMonitorPartHelper in project cubrid-manager by CUBRID.
the class DataProvider method setDefaultValue.
/**
*
* Set the default value
*
*/
private void setDefaultValue() {
boolean isOldExecuteHostStatTask = isExecuteHostStatTask;
isExecuteHostStatTask = false;
isExecuteHeartbeatTask = false;
isExecuteBrokerStatTask = false;
isExecuteDbModeTask = false;
errorMsg = "";
getHeartbeatNodeInfoTask = null;
hostNodeList.clear();
connectedHostNode = null;
uniqueDbNodeList.clear();
uniqueBrokerNodeList.clear();
List<DataUpdateListener> listenerList = generator.getListeners();
for (DataUpdateListener listener : listenerList) {
addHaNode(listener.getModel());
}
if (connectedHostNode == null && !hostNodeList.isEmpty()) {
connectedHostNode = hostNodeList.get(0);
}
if (connectedHostNode == null) {
return;
}
filterDatabaseDataProvider();
if (!uniqueBrokerNodeList.isEmpty()) {
brokerDataProvider.setDataGenerator(generator);
brokerDataProvider.setBrokerNodeList(uniqueBrokerNodeList);
}
//Connect host and set time out
if (!connectedHostNode.isConnected() && !connectedHostNode.isConnecting()) {
for (final HostNode hostNode : hostNodeList) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
hostNode.setConnected(false);
}
});
}
ConnectionManager.connectHost(connectedHostNode, true, !isFirstConnected);
}
final boolean isCanConnected = connectedHostNode.isConnected();
for (final HostNode hostNode : hostNodeList) {
if (hostNode != connectedHostNode) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
hostNode.setConnected(isCanConnected);
hostNode.setErrorMsg(connectedHostNode.getLastErrorMsg());
}
});
}
}
if (isCanConnected) {
isFirstConnected = true;
serverInfo = connectedHostNode.getServerInfo();
if (serverInfo != null) {
MonitoringTask monitoringTask = serverInfo.getMonitoringTask();
monitoringTask.setTimeout(DataProvider.TIME_OUT_MILL);
}
} else {
isFirstConnected = false;
}
for (DataUpdateListener listener : listenerList) {
if (listener instanceof HostMonitorPartHelper) {
isExecuteHostStatTask = isCanConnected;
isExecuteHeartbeatTask = isCanConnected;
} else if (listener instanceof DatabaseMonitorPartHelper) {
isExecuteHostStatTask = isCanConnected;
isExecuteHeartbeatTask = isCanConnected;
isExecuteDbModeTask = isCanConnected;
} else if (listener instanceof HostDashboardViewPart) {
isExecuteHostStatTask = isCanConnected;
isExecuteBrokerStatTask = isCanConnected;
} else if (listener instanceof DatabaseDashboardViewPart) {
isExecuteHostStatTask = isCanConnected;
isExecuteHeartbeatTask = isCanConnected;
isExecuteDbModeTask = isCanConnected;
}
}
ServerType serverType = serverInfo == null ? null : serverInfo.getServerType();
isExecuteBrokerStatTask = isExecuteBrokerStatTask && (serverType == ServerType.BOTH || serverType == ServerType.BROKER);
if (isOldExecuteHostStatTask != isExecuteHostStatTask) {
hostStatRequestCount = 0;
}
}
Aggregations