测试线程池
parent
5c8e646819
commit
9a154b6379
|
@ -2,7 +2,6 @@ package com.muyu.task.feign;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.domain.DataValue;
|
import com.muyu.domain.DataValue;
|
||||||
import com.muyu.task.feign.config.CustomFeignConfig;
|
|
||||||
import com.muyu.task.feign.factory.DataValueClientFactory;
|
import com.muyu.task.feign.factory.DataValueClientFactory;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
@ -19,7 +18,7 @@ import java.util.List;
|
||||||
* @date: 2024/9/4 15:13
|
* @date: 2024/9/4 15:13
|
||||||
*/
|
*/
|
||||||
//,fallback = TaskFeignFallback.class
|
//,fallback = TaskFeignFallback.class
|
||||||
@FeignClient(name = "cloud-source",fallbackFactory = DataValueClientFactory.class,configuration = CustomFeignConfig.class )
|
@FeignClient(name = "cloud-source",fallbackFactory = DataValueClientFactory.class )
|
||||||
public interface DataValueClient {
|
public interface DataValueClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +48,7 @@ public interface DataValueClient {
|
||||||
|
|
||||||
//二维数组查询
|
//二维数组查询
|
||||||
@PostMapping("/DataValue/findTableValueToArray")
|
@PostMapping("/DataValue/findTableValueToArray")
|
||||||
public DataValue[][] findTableValueToArray(@RequestParam("basicId") Long basicId, @RequestParam("sql") String sql, @RequestParam("one") Long one, @RequestParam("two") Integer two);
|
public Result<DataValue[][]> findTableValueToArray(@RequestParam("basicId") Long basicId, @RequestParam("sql") String sql, @RequestParam("one") Long one, @RequestParam("two") Integer two);
|
||||||
|
|
||||||
|
|
||||||
//添加数据值
|
//添加数据值
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class DataValueClientFactory implements FallbackFactory<DataValueClient>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataValue[][] findTableValueToArray(Long basicId, String sql, Long one, Integer two) {
|
public Result<DataValue[][]> findTableValueToArray(Long basicId, String sql, Long one, Integer two) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,21 +237,21 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, TaskInfo> implement
|
||||||
log.info("开始查询数据");
|
log.info("开始查询数据");
|
||||||
log.info("sql{}", sql);
|
log.info("sql{}", sql);
|
||||||
log.info("数组为{},,{}", finalFirstArray, two);
|
log.info("数组为{},,{}", finalFirstArray, two);
|
||||||
DataValue[][] tableValue = dataValueClient.findTableValueToArray(databaseId, sql, finalFirstArray, two);
|
Result<DataValue[][]> result = dataValueClient.findTableValueToArray(databaseId, sql, finalFirstArray, two);
|
||||||
System.out.println("aaa"+tableValue.length);
|
DataValue[][] dataValues = result.getData();
|
||||||
System.out.println("aaa"+tableValue.length);
|
System.out.println("aaa"+dataValues.length);
|
||||||
System.out.println("aaa"+tableValue.length);
|
System.out.println("aaa"+dataValues.length);
|
||||||
System.out.println("aaa"+tableValue.length);
|
System.out.println("aaa"+dataValues.length);
|
||||||
log.info("远程调用完毕,调用数量{}", tableValue.length);
|
log.info("远程调用完毕,调用数量{}", dataValues.length);
|
||||||
for (DataValue[] dataValues : tableValue) {
|
for (DataValue[] dataValue : dataValues) {
|
||||||
for (DataValue dataValue : dataValues) {
|
for (DataValue dataValue1 : dataValue) {
|
||||||
String key = dataValue.getKey();
|
String key = dataValue1.getKey();
|
||||||
String newKey = newAndOldMap.get(key);
|
String newKey = newAndOldMap.get(key);
|
||||||
dataValue.setKey(newKey);
|
dataValue1.setKey(newKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Result result = dataValueClient.addProduct(basicId, tableId, tableValue);
|
Result results = dataValueClient.addProduct(basicId, tableId, dataValues);
|
||||||
log.info("添加结果为{}", result);
|
log.info("添加结果为{}", results);
|
||||||
log.info("添加到queue里成功");
|
log.info("添加到queue里成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -298,7 +298,6 @@ public class PriorityThreadPool {
|
||||||
try {
|
try {
|
||||||
log.info("开始执行任务");
|
log.info("开始执行任务");
|
||||||
task.run();
|
task.run();
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
log.info("执行任务完毕??");
|
log.info("执行任务完毕??");
|
||||||
lowPrioritySemaphore.release();
|
lowPrioritySemaphore.release();
|
||||||
|
|
Loading…
Reference in New Issue