Search in sources :

Example 1 with ThreadCountOutOfBoundsException

use of com.cubrid.common.ui.spi.thread.ThreadCountOutOfBoundsException in project cubrid-manager by CUBRID.

the class DataProvider method executeInThread.

/**
	 * 
	 * Execute task by multi-thread
	 * 
	 * @throws InterruptedException the exception
	 */
public void executeInThread() throws InterruptedException {
    //multi thread execution
    List<Runnable> runnableList = new ArrayList<Runnable>();
    if (isExecuteHostStatTask) {
        hostStatTask = new CommonQueryTask<HostStatData>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), new HostStatData());
        hostStatTask.setTimeout(TIME_OUT_MILL);
        runnableList.add(hostStatTask);
    }
    if (isExecuteBrokerStatTask) {
        brokerDiagTask = new CommonQueryTask<BrokerDiagData>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), new BrokerDiagData());
        brokerDiagTask.setTimeout(TIME_OUT_MILL);
        runnableList.add(brokerDiagTask);
    }
    List<String> dbList = new ArrayList<String>();
    for (DatabaseNode dbNode : uniqueDbNodeList) {
        dbList.add(dbNode.getDbName());
    }
    if (isExecuteHeartbeatTask) {
        getHeartbeatNodeInfoTask = new GetHeartbeatNodeInfoTask(serverInfo);
        getHeartbeatNodeInfoTask.setAllDb(false);
        getHeartbeatNodeInfoTask.setDbList(dbList);
        getHeartbeatNodeInfoTask.setTimeout(TIME_OUT_MILL);
        runnableList.add(getHeartbeatNodeInfoTask);
    }
    if (isExecuteDbModeTask) {
        getDbModeTask = new GetDbModeTask(serverInfo);
        getDbModeTask.setDbList(dbList);
        getDbModeTask.setTimeout(TIME_OUT_MILL);
        runnableList.add(getDbModeTask);
    }
    //execute broker related task
    if (!uniqueBrokerNodeList.isEmpty()) {
        runnableList.addAll(brokerDataProvider.getExecRunnableList());
    }
    if (IS_MULTI_THREAD && !runnableList.isEmpty()) {
        try {
            generator.getThreadPoolManager().execute(runnableList, true);
        } catch (ThreadCountOutOfBoundsException e) {
            LOGGER.error("", e);
        }
        join(runnableList, 350);
        runnableList.clear();
    }
    //get database status information
    List<HADatabaseStatusInfo> dbStatusInfoList = null;
    if (isExecuteDbModeTask) {
        dbStatusInfoList = getDbModeTask.getDbModes();
    }
    //execute database related task
    for (int i = 0; i < dbDataProviderList.size(); i++) {
        DatabaseNode dbNode = dbDataProviderList.get(i).getDatabaseNode();
        HADatabaseStatusInfo dbStatusInfo = HAUtil.getDatabaseStatusInfo(dbStatusInfoList, dbNode.getDbName());
        dbDataProviderList.get(i).setDbStatusInfo(dbStatusInfo);
        runnableList.addAll(dbDataProviderList.get(i).getExecRunnableList());
    }
    if (IS_MULTI_THREAD && !runnableList.isEmpty()) {
        try {
            generator.getThreadPoolManager().execute(runnableList, true);
        } catch (ThreadCountOutOfBoundsException e) {
            LOGGER.error("", e);
        }
        join(runnableList, 20);
    } else {
        execute(runnableList);
    }
}
Also used : ArrayList(java.util.ArrayList) BrokerDiagData(com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData) GetHeartbeatNodeInfoTask(com.cubrid.cubridmanager.core.mondashboard.task.GetHeartbeatNodeInfoTask) GetDbModeTask(com.cubrid.cubridmanager.core.mondashboard.task.GetDbModeTask) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) ThreadCountOutOfBoundsException(com.cubrid.common.ui.spi.thread.ThreadCountOutOfBoundsException) HostStatData(com.cubrid.cubridmanager.core.monitoring.model.HostStatData) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)

Aggregations

ThreadCountOutOfBoundsException (com.cubrid.common.ui.spi.thread.ThreadCountOutOfBoundsException)1 HADatabaseStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)1 GetDbModeTask (com.cubrid.cubridmanager.core.mondashboard.task.GetDbModeTask)1 GetHeartbeatNodeInfoTask (com.cubrid.cubridmanager.core.mondashboard.task.GetHeartbeatNodeInfoTask)1 BrokerDiagData (com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData)1 HostStatData (com.cubrid.cubridmanager.core.monitoring.model.HostStatData)1 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)1 ArrayList (java.util.ArrayList)1