测试线程池
parent
89932f17fe
commit
5c27bea894
|
@ -205,6 +205,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, TaskInfo> implement
|
|||
|
||||
if(taskInfo.getWeigh() == 3){
|
||||
log.info("执行高级任务");
|
||||
log.info("sql为{}",finalSql);
|
||||
executeHigh(() -> {
|
||||
selectAndAdd(finalDatabaseId, basicId, finalSql, tableId,newAndOldMap, finalFirstArray,two);
|
||||
});
|
||||
|
@ -212,6 +213,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, TaskInfo> implement
|
|||
|
||||
if(taskInfo.getWeigh() == 2){
|
||||
log.info("执行中级任务");
|
||||
log.info("sql为{}",finalSql);
|
||||
executeMedium(() -> {
|
||||
selectAndAdd(finalDatabaseId, basicId, finalSql, tableId,newAndOldMap, finalFirstArray,two);
|
||||
});
|
||||
|
@ -219,6 +221,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, TaskInfo> implement
|
|||
|
||||
if(taskInfo.getWeigh() == 1){
|
||||
log.info("执行低级任务");
|
||||
log.info("sql为{}",finalSql);
|
||||
executeLow(() -> {
|
||||
selectAndAdd(finalDatabaseId, basicId, finalSql, tableId,newAndOldMap, finalFirstArray,two);
|
||||
});
|
||||
|
@ -234,6 +237,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, TaskInfo> implement
|
|||
|
||||
private void selectAndAdd(Long databaseId,Long basicId,String sql,Long tableId,
|
||||
HashMap<String,String> newAndOldMap,Long firstArray ,Integer two) {
|
||||
log.info("开始查询数据");
|
||||
log.info("数组为{},,{}",firstArray ,two);
|
||||
DataValue[][] tableValue = dataValueClient.findTableValueToArray(databaseId, sql, firstArray,two);
|
||||
log.info("远程调用完毕,调用数量{}",tableValue.length);
|
||||
for (DataValue[] dataValues : tableValue) {
|
||||
|
|
|
@ -30,7 +30,7 @@ public class PriorityThreadPool {
|
|||
|
||||
|
||||
private static final ExecutorService executor =
|
||||
new ThreadPoolExecutor(TOTAL_THREADS, TOTAL_THREADS, 60L, TimeUnit.MILLISECONDS,
|
||||
new ThreadPoolExecutor(TOTAL_THREADS, TOTAL_THREADS, 80L, TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<Runnable>());
|
||||
|
||||
private static final Semaphore HIGH_PRIORITY_SEMAPHORE = new Semaphore(HIGH_THREADS);
|
||||
|
|
Loading…
Reference in New Issue