use of com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos in project cubrid-manager by CUBRID.
the class ClientNode method propertyChange.
/**
* Litsen the broker's status changing.
*
* @param evt PropertyChangeEvent
*/
public void propertyChange(PropertyChangeEvent evt) {
if (BrokerNode.PROP_BROKER_STATUS.equals(evt.getPropertyName())) {
BrokerStatusInfos bsi = brokerNode.getBrokerStatusInfos();
clientList.clear();
if (bsi == null || bsi.getAsinfo() == null || bsi.getAsinfo().isEmpty()) {
fireStructureChange(PROP_CLIENT_LIST, clientList);
return;
}
for (ApplyServerInfo asi : bsi.getAsinfo()) {
if (StringUtil.isEmpty(asi.getAs_client_ip()) || clientList.contains(asi.getAs_client_ip())) {
continue;
}
clientList.add(asi.getAs_client_ip());
}
fireStructureChange(PROP_CLIENT_LIST, clientList);
}
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos in project cubrid-manager by CUBRID.
the class GetBrokerStatusInfosTaskTest method testSend.
public void testSend() {
BrokerStatusInfos brokerStatusInfos = new BrokerStatusInfos();
final GetBrokerStatusInfosTask<BrokerStatusInfos> task = new GetBrokerStatusInfosTask<BrokerStatusInfos>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), brokerStatusInfos);
task.setBrokerName("query_editor");
task.execute();
brokerStatusInfos = task.getResultModel();
assertEquals(brokerStatusInfos.getBname(), "query_editor");
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos in project cubrid-manager by CUBRID.
the class HaShardDemo method getBrokerNodeInfo.
protected NodeInfo getBrokerNodeInfo(ServerInfo serverInfo) {
BrokerNode nodeInfo = new BrokerNode();
BrokerInfos brokerInfos = new BrokerInfos();
GetBrokerStatusInfosTask<BrokerInfos> getBrokerStatusInfosTask = new GetBrokerStatusInfosTask<BrokerInfos>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), brokerInfos);
getBrokerStatusInfosTask.execute();
if (!getBrokerStatusInfosTask.isSuccess()) {
return null;
}
brokerInfos = getBrokerStatusInfosTask.getResultModel();
BrokerInfoList brokerInfoList = brokerInfos.getBorkerInfoList();
if (!(brokerInfoList != null && brokerInfoList.getBrokerInfoList() != null && brokerInfoList.getBrokerInfoList().size() > 0)) {
return null;
}
nodeInfo.setBrokerInfoList(brokerInfoList);
//Set<String> dbHosts = new HashSet<String>();
for (BrokerInfo brokerInfo : brokerInfoList.getBrokerInfoList()) {
if (brokerInfo == null) {
continue;
}
String brokerName = brokerInfo.getName();
String brokerPort = brokerInfo.getPort();
BrokerStatusInfos brokerStatusInfos = new BrokerStatusInfos();
GetBrokerStatusInfosTask<BrokerStatusInfos> statisTask = new GetBrokerStatusInfosTask<BrokerStatusInfos>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), brokerStatusInfos);
statisTask.setBrokerName(brokerName);
statisTask.execute();
if (!statisTask.isSuccess()) {
continue;
}
brokerStatusInfos = statisTask.getResultModel();
nodeInfo.addBrokerStatus(brokerPort, brokerStatusInfos);
}
return nodeInfo;
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos in project cubrid-manager by CUBRID.
the class BrokerDashboardViewPart method performUpdate.
/**
* Perform update UI when data change event happen
*
* @param dataChangedEvent the instance of DataChangedEvent
*/
public void performUpdate(DataChangedEvent dataChangedEvent) {
if (composite == null || composite.isDisposed()) {
return;
}
if (dataChangedEvent != null) {
String brokerName = brokerNode.getBrokerName();
BrokerInfos brokerInfos = dataChangedEvent.getBrokerInfosMap().get(brokerName);
BrokerStatusInfos brokerStatusInfos = dataChangedEvent.getBrokerStatusInfosMap().get(brokerName);
BrokerDiagData brokerDiagData = dataChangedEvent.getBrokerDiagDataMap().get(brokerName);
List<String> basicTableLst = new ArrayList<String>();
if (brokerInfos == null) {
for (int i = 0; i < 10; i++) {
basicTableLst.add("");
}
} else {
BrokerInfoList brokerInfoList = brokerInfos.getBorkerInfoList();
if (brokerInfoList.getBrokerInfoList().isEmpty()) {
for (int i = 0; i < 10; i++) {
basicTableLst.add("");
}
}
for (BrokerInfo bi : brokerInfoList.getBrokerInfoList()) {
if (brokerName.equals(bi.getName())) {
basicTableLst.add(bi.getPid());
basicTableLst.add(bi.getPort());
basicTableLst.add(bi.getJq());
basicTableLst.add(bi.getAuto());
basicTableLst.add(bi.getSqll());
basicTableLst.add(bi.getLong_tran_time());
basicTableLst.add(bi.getLong_query_time());
basicTableLst.add(bi.getSes());
basicTableLst.add(bi.getKeep_conn());
basicTableLst.add(bi.getAccess_mode());
}
}
}
if (brokerDiagData == null) {
for (int i = 0; i < 3; i++) {
basicTableLst.add("");
}
} else {
basicTableLst.add(brokerDiagData.getCas_mon_active());
basicTableLst.add(brokerDiagData.getCas_mon_session());
basicTableLst.add(brokerDiagData.getCas_mon_tran());
}
//test
List<List<String>> basicColumnLst = new ArrayList<List<String>>();
basicColumnLst.add(basicTableLst);
basicTableViewer.setInput(basicColumnLst);
basicTableViewer.refresh();
List<ApplyServerInfo> asinfoLst = null;
List<JobInfo> jobinfoLst = null;
if (brokerStatusInfos == null) {
asinfoLst = new ArrayList<ApplyServerInfo>();
jobinfoLst = new ArrayList<JobInfo>();
} else {
asinfoLst = brokerStatusInfos.getAsinfo();
jobinfoLst = brokerStatusInfos.getJobinfo();
if (asinfoLst == null) {
asinfoLst = new ArrayList<ApplyServerInfo>();
}
if (jobinfoLst == null) {
jobinfoLst = new ArrayList<JobInfo>();
}
}
asTableViewer.setInput(asinfoLst);
asTableViewer.refresh();
jqTableViewer.setInput(jobinfoLst);
jqTableViewer.refresh();
}
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos in project cubrid-manager by CUBRID.
the class BrokerDataProvider method getUpdateValue.
/**
*
* Get broker related update value
*
* @return DataChangedEvent
*
*/
public DataChangedEvent getUpdateValue() {
DataChangedEvent dataChangedEvent = new DataChangedEvent(this);
if (!isExecGetBrokerTask) {
setErrorMsg("");
return dataChangedEvent;
}
if (isExecGetBrokerTask) {
BrokerInfos brokerInfos = performGetBrokersInfoTask();
if (serverInfo != null) {
serverInfo.setBrokerInfos(brokerInfos);
}
BrokerStatusInfos brokerStatusInfos = performGetBrokersStatusTask();
if (brokerdiagRequestCount < 2) {
performGetBrokerDiagDataTask(null);
}
for (BrokerNode brokerNode : brokerNodeList) {
String brokerName = brokerNode.getBrokerName();
dataChangedEvent.getBrokerInfosMap().put(brokerName, brokerInfos);
dataChangedEvent.getBrokerStatusInfosMap().put(brokerName, brokerStatusInfos == null ? null : brokerStatusInfos.getSubBrokerByName(brokerName));
if (brokerdiagRequestCount >= 2) {
dataChangedEvent.getBrokerDiagDataMap().put(brokerName, performGetBrokerDiagDataTask(brokerName));
}
}
}
setErrorMsg(errorMsg);
if (errorMsg != null && errorMsg.trim().length() > 0) {
LOGGER.error(errorMsg);
}
return dataChangedEvent;
}
Aggregations