This commit is contained in:
wangliwen 2022-12-16 09:41:55 +08:00
parent 81fe70aa42
commit 859edc9864
8 changed files with 9 additions and 9 deletions

View File

@ -43,7 +43,7 @@ import java.util.concurrent.Executors;
public class ActivitiNoticeAspect { public class ActivitiNoticeAspect {
private static final Integer CPU_NUM = Runtime.getRuntime().availableProcessors(); private static final Integer CPU_NUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService EXECUTOR = Executors.newFixedThreadPool(CPU_NUM * 3); private static final ExecutorService EXECUTOR = Executors.newWorkStealingPool(CPU_NUM * 3);
private static final Logger LOGGER = LoggerFactory.getLogger(ActivitiNoticeAspect.class); private static final Logger LOGGER = LoggerFactory.getLogger(ActivitiNoticeAspect.class);
@Autowired @Autowired

View File

@ -46,7 +46,7 @@ import java.util.stream.Collectors;
@RequestMapping("/ability/center") @RequestMapping("/ability/center")
public class AbilityCenterController { public class AbilityCenterController {
private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors(); private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm); private static final ExecutorService executor = Executors.newWorkStealingPool(cpuNUm);
private static final Logger logger = LoggerFactory.getLogger(AbilityCenterController.class); private static final Logger logger = LoggerFactory.getLogger(AbilityCenterController.class);

View File

@ -52,7 +52,7 @@ import java.util.stream.Collectors;
public class CensusController { public class CensusController {
private static final Logger logger = LoggerFactory.getLogger(CensusController.class); private static final Logger logger = LoggerFactory.getLogger(CensusController.class);
private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM); private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM);
@Autowired @Autowired
private ResourceService resourceService; private ResourceService resourceService;

View File

@ -35,7 +35,7 @@ import java.util.concurrent.Executors;
@RequestMapping("/comment/center") @RequestMapping("/comment/center")
public class CommentController { public class CommentController {
private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM); private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM);
private static final ObjectMapper oMapper = new ObjectMapper(); private static final ObjectMapper oMapper = new ObjectMapper();
@Autowired @Autowired

View File

@ -30,7 +30,7 @@ import java.util.concurrent.Executors;
@Component @Component
public class InitiatorDataEntryListener implements TaskListener { public class InitiatorDataEntryListener implements TaskListener {
private static final Integer CPU_NUM = Runtime.getRuntime().availableProcessors(); private static final Integer CPU_NUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService EXECUTOR = Executors.newFixedThreadPool(CPU_NUM * 3); private static final ExecutorService EXECUTOR = Executors.newWorkStealingPool(CPU_NUM * 3);
private static final Logger logger = LoggerFactory.getLogger(InitiatorDataEntryListener.class); private static final Logger logger = LoggerFactory.getLogger(InitiatorDataEntryListener.class);

View File

@ -24,7 +24,7 @@ public class UpdateUtil {
private static final Logger logger = LoggerFactory.getLogger(UpdateUtil.class); private static final Logger logger = LoggerFactory.getLogger(UpdateUtil.class);
private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM); private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM);
private static final String pwd = System.getProperty("user.dir"); private static final String pwd = System.getProperty("user.dir");
private static final OkHttpClient client = new OkHttpClient().newBuilder().connectTimeout(1, TimeUnit.MINUTES).readTimeout(2, TimeUnit.MINUTES).connectionPool(new ConnectionPool(CPUNUM * 2, 2, TimeUnit.MINUTES)).retryOnConnectionFailure(false).build(); // 下载更新包的工具 private static final OkHttpClient client = new OkHttpClient().newBuilder().connectTimeout(1, TimeUnit.MINUTES).readTimeout(2, TimeUnit.MINUTES).connectionPool(new ConnectionPool(CPUNUM * 2, 2, TimeUnit.MINUTES)).retryOnConnectionFailure(false).build(); // 下载更新包的工具

View File

@ -37,7 +37,7 @@ import java.util.stream.Collectors;
@Service @Service
public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao, TDemandCommentEntity, TDemandCommentDTO> implements TDemandCommentService { public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao, TDemandCommentEntity, TDemandCommentDTO> implements TDemandCommentService {
private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM); private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM);
@Autowired @Autowired
private TDemandDataService tDemandDataService; private TDemandDataService tDemandDataService;
@Autowired @Autowired

View File

@ -74,7 +74,7 @@ import java.util.stream.Collectors;
@Api(tags = "资源表") @Api(tags = "资源表")
public class ResourceController { public class ResourceController {
private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM); private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM * 2);
@Value("${big_date.name}") @Value("${big_date.name}")
private String bigDateDeptName; // 大数据局名称 private String bigDateDeptName; // 大数据局名称
@ -264,7 +264,7 @@ public class ResourceController {
* *
* @return * @return
*/ */
@GetMapping("/updateTest") @GetMapping("/updateInfoList")
public Result<String> updateTest() { public Result<String> updateTest() {
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
List<Long> ids = jdbcTemplate.queryForList("SELECT id FROM tb_data_resource", Long.class); List<Long> ids = jdbcTemplate.queryForList("SELECT id FROM tb_data_resource", Long.class);