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);
}
}
Aggregations