Search in sources :

Example 6 with BrokerStatusInfos

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);
    }
}
Also used : ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) BrokerStatusInfos(com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)

Example 7 with BrokerStatusInfos

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");
}
Also used : BrokerStatusInfos(com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)

Example 8 with BrokerStatusInfos

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;
}
Also used : BrokerNode(com.cubrid.cubridmanager.core.cubrid.service.model.BrokerNode) BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) GetBrokerStatusInfosTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerStatusInfosTask) BrokerInfoList(com.cubrid.cubridmanager.core.broker.model.BrokerInfoList) BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo) BrokerStatusInfos(com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)

Example 9 with BrokerStatusInfos

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();
    }
}
Also used : BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) ArrayList(java.util.ArrayList) BrokerDiagData(com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData) BrokerInfoList(com.cubrid.cubridmanager.core.broker.model.BrokerInfoList) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) BrokerStatusInfos(com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos) BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo) JobInfo(com.cubrid.cubridmanager.core.broker.model.JobInfo) BrokerInfoList(com.cubrid.cubridmanager.core.broker.model.BrokerInfoList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 10 with BrokerStatusInfos

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;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) BrokerStatusInfos(com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)

Aggregations

BrokerStatusInfos (com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)16 ApplyServerInfo (com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo)10 BrokerInfoList (com.cubrid.cubridmanager.core.broker.model.BrokerInfoList)6 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)5 GetBrokerStatusInfosTask (com.cubrid.cubridmanager.core.broker.task.GetBrokerStatusInfosTask)5 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)4 BrokerInfo (com.cubrid.cubridmanager.core.broker.model.BrokerInfo)3 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)3 HashSet (java.util.HashSet)2 List (java.util.List)2 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)1 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)1 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)1 JobInfo (com.cubrid.cubridmanager.core.broker.model.JobInfo)1 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)1 BrokerNode (com.cubrid.cubridmanager.core.cubrid.service.model.BrokerNode)1 BrokerDiagData (com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData)1 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)1 Set (java.util.Set)1