1. 程式人生 > 其它 >springboot httpclent 多執行緒推送資料

springboot httpclent 多執行緒推送資料

不廢話直接程式碼

public void uploadCoreIndicatorsGroup(){
        //啟用多執行緒處理
        ExecutorService executorService = Executors.newCachedThreadPool();
        //推送域名管理04
        executorService.execute(() -> {
            Map<String,Integer> baseLineMap = new HashMap<>();
            baseLineMap.put(
"domain_AResolutionRate",1); baseLineMap.put("domain_AAAAResolutionRate",1); pushNetSafeGroup("04",baseLineMap); }); //推送網路安全05 executorService.execute(() -> { Map<String,Integer> baseLineMap = new HashMap<>(); baseLineMap.put(
"ns_DDOSattack",0); pushNetSafeGroup("05",baseLineMap); }); executorService.shutdown(); try { executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); } catch (InterruptedException e) { e.printStackTrace(); } }
View Code