| | |
| | | private final IUserService userService; |
| | | |
| | | private final static String appId = "46a23e7c5fe54f46a37848dc740dc001"; |
| | | |
| | | private final static String appSecret = "AxVGmJcsfxEx36zptmr8J+sv7MAhL1mUuwrk4woGUrM="; |
| | | // 测试key |
| | | // private final static String appId = "30980cc0e70246df89f8b96b609db055"; |
| | | // private final static String appSecret = "tZnrux6iKg0DWjFA8Pohf/ht4ARIREv2oHpRbSF/5us="; |
| | | |
| | | private final static String method = "post"; |
| | | |
| | |
| | | |
| | | int pcount = Runtime.getRuntime().availableProcessors(); |
| | | //最大线程数控制 |
| | | int maxthreadNum = accountBeanList.size(); |
| | | int maxthreadNum = 30; |
| | | ExecutorService executor = new ThreadPoolExecutor(pcount, maxthreadNum, 10, TimeUnit.SECONDS, |
| | | new ArrayBlockingQueue<>(1000), Executors.defaultThreadFactory(), new ThreadPoolExecutor.CallerRunsPolicy()); |
| | | System.out.println("开始执行用户处理!!!!!!!!!!!!"); |
| | | |
| | | executor.execute(() -> { |
| | | //业务处理 |
| | | //循环list |
| | | for (int i = 0; i < maxthreadNum; i++) { |
| | | final int index = i; |
| | | final AccountBean accountBean = accountBeanList.get(i); |
| | | executor.execute(() -> { |
| | | //业务处理 |
| | | System.out.println("当前线程:" + Thread.currentThread().getName() + " " + index); |
| | | System.out.println("当前处理对象:" + JSON.toJSONString(accountBean)); |
| | | asyncUserGo(accountBean); |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | // 关闭线程池 |
| | | executor.shutdown(); |
| | | |