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