use of com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData in project cubrid-manager by CUBRID.
the class CommonQueryTaskTest method testTask.
public void testTask() {
CommonQueryTask<StandbyServerStat> standbyServerStatTask = new CommonQueryTask<StandbyServerStat>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), new StandbyServerStat(), "UTF-8");
standbyServerStatTask.setDbName(testDbName);
standbyServerStatTask.setDbid(dbaUserName);
standbyServerStatTask.setDbpasswd(dbaPassword);
standbyServerStatTask.execute();
standbyServerStatTask.getResultModel();
CommonQueryTask<BrokerDiagData> brokerDiagDataTask = new CommonQueryTask<BrokerDiagData>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), new BrokerDiagData());
brokerDiagDataTask.setBName("query_editor");
brokerDiagDataTask.execute();
brokerDiagDataTask.getResultModel();
brokerDiagDataTask.setBroker("query_editor");
CommonQueryTask<KillTransactionList> task = new CommonQueryTask<KillTransactionList>(serverInfo, CommonSendMsg.getKillTransactionMSGItems(), new KillTransactionList());
task.setDbName(testDbName);
task.setKillTranType(KillTranType.H);
task.setKillTranParameter("localhost");
}
use of com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData in project cubrid-manager by CUBRID.
the class HostDashboardHistoryViewPart method loadBrokerChart.
/**
* Load an instance of ChartCompositePart stand for broker monitor info
*
* @param parent the instance of Composite
*/
private void loadBrokerChart(Composite parent) {
brokerComp = new Composite(parent, SWT.NULL);
brokerComp.setLayout(new GridLayout());
brokerComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Group brokerGrp = new Group(brokerComp, SWT.NONE);
brokerGrp.setText(Messages.hostBrokerSeriesGroupName);
GridLayout layoutGrp = new GridLayout();
layoutGrp.verticalSpacing = 0;
layoutGrp.horizontalSpacing = 0;
layoutGrp.marginLeft = 0;
layoutGrp.marginRight = 0;
layoutGrp.marginTop = 0;
layoutGrp.marginBottom = 0;
brokerGrp.setLayout(layoutGrp);
GridData gridData = new GridData(GridData.FILL_BOTH);
brokerGrp.setLayoutData(gridData);
BrokerDiagData brokerDiagData = new BrokerDiagData();
TreeMap<String, String> map = convertMapKey(brokerDiagData.getDiagStatusResultMap());
brokerChartPart = new ChartCompositePart(brokerGrp, map);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = brokerChartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.BROKER);
}
brokerChartPart.loadContent();
JFreeChart chart = (JFreeChart) brokerChartPart.getChart();
chart.setBorderVisible(false);
XYPlot xyplot = (XYPlot) brokerChartPart.getChart().getPlot();
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
renderer.setURLGenerator(null);
renderer.setBaseToolTipGenerator(null);
}
use of com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData in project cubrid-manager by CUBRID.
the class BrokerDataProvider method performGetBrokerDiagDataTask.
/**
*
* Perform "getbrokerdiagdata" task
*
* @param brokerName String
* @return BrokerDiagData
*/
public BrokerDiagData performGetBrokerDiagDataTask(String brokerName) {
BrokerDiagData brokerDiagStatusResult = brokerDiagDataTask == null ? null : brokerDiagDataTask.getResultModel();
if (brokerDiagStatusResult == null) {
return null;
}
if (!brokerDiagStatusResult.getStatus()) {
String detailMsg = "can not get session and active session and TPS information.";
showErrorMsg(brokerDiagDataTask.getErrorMsg(), detailMsg);
return null;
}
if (brokerdiagRequestCount == 0) {
brokerDiagOldOneStatusResult = new BrokerDiagData();
brokerDiagOldTwoStatusResult = new BrokerDiagData();
brokerdiagRequestCount++;
brokerDiagOldOneStatusResult.copyFrom(brokerDiagStatusResult);
} else if (brokerdiagRequestCount == 1) {
lastSec = Calendar.getInstance();
BrokerDiagData brokerDiagDataDelta = new BrokerDiagData();
brokerDiagDataDelta.getDelta(brokerDiagStatusResult, brokerDiagOldOneStatusResult);
brokerdiagRequestCount++;
brokerDiagOldTwoStatusResult.copyFrom(brokerDiagOldOneStatusResult);
brokerDiagOldOneStatusResult.copyFrom(brokerDiagStatusResult);
} else {
nowSec = Calendar.getInstance();
double interval = (double) (nowSec.getTimeInMillis() - lastSec.getTimeInMillis()) / 1000;
inter = (float) interval;
lastSec = nowSec;
BrokerDiagData latest = brokerDiagStatusResult.getSubBrokerByName(brokerName);
BrokerDiagData oldOne = brokerDiagOldOneStatusResult.getSubBrokerByName(brokerName);
BrokerDiagData oldTwo = brokerDiagOldTwoStatusResult.getSubBrokerByName(brokerName);
if (latest == null || oldOne == null || oldTwo == null) {
return null;
}
BrokerDiagData brokerDiagStatusResultDelta = new BrokerDiagData();
brokerDiagStatusResultDelta.getDelta(latest, oldOne, oldTwo, inter);
brokerDiagOldTwoStatusResult.copyFrom(brokerDiagOldOneStatusResult);
brokerDiagOldOneStatusResult.copyFrom(brokerDiagStatusResult);
return brokerDiagStatusResultDelta;
}
return null;
}
use of com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData in project cubrid-manager by CUBRID.
the class BrokerNode method setBrokerDiagData.
/**
* Set BrokerDiagData
*
* @param diagStatusResult BrokerDiagData
*/
public void setBrokerDiagData(BrokerDiagData diagStatusResult) {
BrokerDiagData old = this.diagStatusResult;
this.diagStatusResult = diagStatusResult;
this.firePropertyChange(PROP_BROKER_STATUS, old, diagStatusResult);
}
use of com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData in project cubrid-manager by CUBRID.
the class BrokerMonitorPart method refreshVisuals.
/**
* Refreshes this EditPart's <i>visuals</i>. This method is called by
* {@link #refresh()}, and may also be called in response to notifications
* from the model.
*/
protected void refreshVisuals() {
BrokerMonitorFigure figure = (BrokerMonitorFigure) this.getFigure();
BrokerNode broker = (BrokerNode) this.getModel();
setMode2View(figure, broker);
BrokerDiagData dsr = broker.getBrokerDiagData();
if (dsr == null) {
figure.setSessionCount(0);
figure.setActiveSessionCount(0);
figure.setActiveSessionCount(0);
figure.setTps(0);
} else {
figure.setSessionCount(Integer.parseInt(dsr.getCas_mon_session()));
//Avoid looks like ActiveSessionCount larger then SessionCount
figure.setActiveSessionCount(Integer.parseInt(dsr.getCas_mon_session()));
figure.setActiveSessionCount(Integer.parseInt(dsr.getCas_mon_active()));
figure.setTps(Integer.parseInt(dsr.getCas_mon_tran()));
}
super.refreshVisuals();
}
Aggregations