use of com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos in project cubrid-manager by CUBRID.
the class BrokerNodeTest method buildFakeData.
public void buildFakeData(BrokerNode brokerNode) {
DbLocationInfo dbLocalInfo = new DbLocationInfo();
dbLocalInfo.setDbName("demodb");
dbLocalInfo.setVolPath("/home1/demo/CUBRID/databases/demodb");
dbLocalInfo.setLobBasePath("file:/home1/demo/CUBRID/databases/demodb/lob");
dbLocalInfo.setLogPath("/home1/demo/CUBRID/databases/demodb");
dbLocalInfo.addDbHost("localhost");
List<DbLocationInfo> dbLocationInfoList = new ArrayList<DbLocationInfo>();
dbLocationInfoList.add(dbLocalInfo);
brokerNode.setDbLocationInfoList(dbLocationInfoList);
BrokerStatusInfos bStatInfos = new BrokerStatusInfos();
bStatInfos.setBname("query_editor");
Map<String, BrokerStatusInfos> brokerStatusMap = new HashMap<String, BrokerStatusInfos>();
brokerStatusMap.put("query_editor", bStatInfos);
brokerNode.setBrokerStatusMap(brokerStatusMap);
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method loadBrokerInfo.
/**
* load broker information
*/
public void loadBrokerInfo() {
// if database is stop, do not get data
if (database.getRunningType() != DbRunningType.CS) {
return;
}
// broker info tasks
BrokerInfos brokerInfos = new BrokerInfos();
final CommonQueryTask<BrokerInfos> brokerInfosTask = new CommonQueryTask<BrokerInfos>(database.getServer().getServerInfo(), CommonSendMsg.getCommonSimpleSendMsg(), brokerInfos);
new Thread(new Runnable() {
public void run() {
brokerInfosTask.execute();
if (!brokerInfosTask.isSuccess()) {
brokerInfosTask.finish();
return;
}
Display.getDefault().asyncExec(new Runnable() {
public void run() {
process();
}
});
}
private void process() {
asinfoLst.clear();
brokerInfoListData.clear();
BrokerInfos brokerInfos = brokerInfosTask.getResultModel();
if (null != brokerInfos) {
BrokerInfoList list = brokerInfos.getBorkerInfoList();
if (list != null && list.getBrokerInfoList() != null) {
// all broker
List<BrokerInfo> newBrokerInfoList = list.getBrokerInfoList();
for (BrokerInfo brokerInfo : newBrokerInfoList) {
BrokerStatusInfos brokerStatusInfos = new BrokerStatusInfos();
final GetBrokerStatusInfosTask<BrokerStatusInfos> statisTask = new GetBrokerStatusInfosTask<BrokerStatusInfos>(database.getServer().getServerInfo(), CommonSendMsg.getGetBrokerStatusItems(), brokerStatusInfos);
statisTask.setBrokerName(brokerInfo.getName());
statisTask.execute();
brokerStatusInfos = statisTask.getResultModel();
if (brokerStatusInfos != null) {
//one broker status
List<ApplyServerInfo> applyServerInfoList = brokerStatusInfos.getAsinfo();
for (ApplyServerInfo applyServerInfo : applyServerInfoList) {
if (database.getName().equalsIgnoreCase(applyServerInfo.getAs_dbname())) {
HashMap<String, ApplyServerInfo> valueMap = new HashMap<String, ApplyServerInfo>();
valueMap.put(brokerInfo.getName(), applyServerInfo);
asinfoLst.add(valueMap);
}
}
}
statisTask.finish();
}
}
}
//set task obejct to table view
for (HashMap<String, ApplyServerInfo> brokerValueMap : asinfoLst) {
for (Entry<String, ApplyServerInfo> entry : brokerValueMap.entrySet()) {
String brokerName = entry.getKey();
ApplyServerInfo applyServerInfo = entry.getValue();
Map<String, String> brokerInfoMap = new HashMap<String, String>();
brokerInfoMap.put("0", brokerName);
brokerInfoMap.put("1", applyServerInfo.getAs_id());
brokerInfoMap.put("2", applyServerInfo.getAs_pid());
brokerInfoMap.put("3", applyServerInfo.getAs_num_query());
brokerInfoMap.put("4", applyServerInfo.getAs_long_query());
brokerInfoMap.put("5", applyServerInfo.getAs_status());
brokerInfoMap.put("6", applyServerInfo.getAs_lct());
brokerInfoListData.add(brokerInfoMap);
}
}
setBrokerInfoData();
brokerInfosTask.finish();
}
}).start();
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos in project cubrid-manager by CUBRID.
the class BrokerStatusView method refresh.
/**
*
* Refresh the page content
*
* @param isUpdateTable whether update table
* @param isRefreshChanged whether refresh changed
*/
public void refresh(boolean isUpdateTable, boolean isRefreshChanged) {
ServerInfo site = brokerNode.getServer().getServerInfo();
if (isSupportNewBrokerParamPropery) {
refreshBasicTable(site);
}
BrokerStatusInfos brokerStatusInfos = new BrokerStatusInfos();
final GetBrokerStatusInfosTask<BrokerStatusInfos> task = new GetBrokerStatusInfosTask<BrokerStatusInfos>(site, CommonSendMsg.getGetBrokerStatusItems(), brokerStatusInfos);
task.setBrokerName(nodeName);
task.execute();
if (!task.isSuccess()) {
return;
}
brokerStatusInfos = task.getResultModel();
//job queue
if (brokerStatusInfos != null) {
jobinfoLst = brokerStatusInfos.getJobinfo();
jqTableViewer.setInput(jobinfoLst);
jqTableViewer.refresh();
}
//apply server
List<ApplyServerInfo> newAsInfoLst = null;
if (null != brokerStatusInfos) {
newAsInfoLst = brokerStatusInfos.getAsinfo();
}
List<ApplyServerInfo> changedAsInfoLst = new ArrayList<ApplyServerInfo>();
for (int i = 0; newAsInfoLst != null && i < newAsInfoLst.size(); i++) {
ApplyServerInfo newAsInfo = newAsInfoLst.get(i);
ApplyServerInfo changedAsInfo = newAsInfo.clone();
for (int j = 0; oldAsInfoLst != null && j < oldAsInfoLst.size(); j++) {
ApplyServerInfo oldAsInfo = oldAsInfoLst.get(j);
if (newAsInfo.getAs_id().equalsIgnoreCase(oldAsInfo.getAs_id())) {
long newQuery = StringUtil.intValue(newAsInfo.getAs_num_query());
long newTran = StringUtil.intValue(newAsInfo.getAs_num_tran());
long newLongQuery = StringUtil.longValue(newAsInfo.getAs_long_query());
long newLongTran = StringUtil.longValue(newAsInfo.getAs_long_tran());
long newErrQuery = StringUtil.intValue(newAsInfo.getAs_error_query());
long oldQuery = StringUtil.intValue(oldAsInfo.getAs_num_query());
long oldTran = StringUtil.intValue(oldAsInfo.getAs_num_tran());
long oldLongQuery = StringUtil.longValue(oldAsInfo.getAs_long_query());
long oldLongTran = StringUtil.longValue(oldAsInfo.getAs_long_tran());
long oldErrQuery = StringUtil.intValue(oldAsInfo.getAs_error_query());
long changedQuery = newQuery - oldQuery;
long changedTran = newTran - oldTran;
long changedLongTran = newLongTran - oldLongTran;
long changedLongQuery = newLongQuery - oldLongQuery;
long changedErrQuery = newErrQuery - oldErrQuery;
changedAsInfo.setAs_num_query(String.valueOf(changedQuery > 0 ? changedQuery : 0));
changedAsInfo.setAs_num_tran(String.valueOf(changedTran > 0 ? changedTran : 0));
changedAsInfo.setAs_long_tran(String.valueOf(changedLongTran > 0 ? changedLongTran : 0));
changedAsInfo.setAs_long_query(String.valueOf(changedLongQuery > 0 ? changedLongQuery : 0));
changedAsInfo.setAs_error_query(String.valueOf(changedErrQuery > 0 ? changedErrQuery : 0));
break;
}
}
changedAsInfoLst.add(changedAsInfo);
}
oldAsInfoLst = newAsInfoLst;
if (isUpdateTable) {
if (isRefreshChanged) {
asTableViewer.setInput(changedAsInfoLst);
} else {
asTableViewer.setInput(oldAsInfoLst);
}
}
asTableViewer.refresh();
//job queue
jobinfoLst = brokerStatusInfos.getJobinfo();
jqTableViewer.setInput(jobinfoLst);
jqTableViewer.refresh();
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos in project cubrid-manager by CUBRID.
the class BrokerStatusView method refresh.
/**
* Refresh this view
*
*/
public void refresh() {
ServerInfo site = brokerNode.getServer().getServerInfo();
if (isSupportNewBrokerParamPropery) {
refreshBasicTable(site);
}
BrokerStatusInfos brokerStatusInfos = new BrokerStatusInfos();
final GetBrokerStatusInfosTask<BrokerStatusInfos> task = new GetBrokerStatusInfosTask<BrokerStatusInfos>(site, CommonSendMsg.getGetBrokerStatusItems(), brokerStatusInfos);
task.setBrokerName(nodeName);
task.execute();
if (!task.isSuccess()) {
return;
}
brokerStatusInfos = task.getResultModel();
asinfoLst = brokerStatusInfos.getAsinfo();
jobinfoLst = brokerStatusInfos.getJobinfo();
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 BrokerNode method setBrokerStatusInfos.
/**
* Set broker status.
*
* @param brokerStatusInfos BrokerStatusInfos
*/
public void setBrokerStatusInfos(BrokerStatusInfos brokerStatusInfos) {
BrokerStatusInfos old = this.brokerStatusInfos;
this.brokerStatusInfos = brokerStatusInfos;
this.firePropertyChange(PROP_BROKER_STATUS, old, brokerStatusInfos);
}
Aggregations