{"action":"opened","issue":{"url":"https://api.github.com/repos/sxfad/porter/issues/7","repository_url":"https://api.github.com/repos/sxfad/porter","labels_url":"https://api.github.com/repos/sxfad/porter/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/sxfad/porter/issues/7/comments","events_url":"https://api.github.com/repos/sxfad/porter/issues/7/events","html_url":"https://github.com/sxfad/porter/issues/7","id":381475400,"node_id":"MDU6SXNzdWUzODE0NzU0MDA=","number":7,"title":"AlerterFactory关闭线程池","user":{"login":"aipan","id":12508754,"node_id":"MDQ6VXNlcjEyNTA4NzU0","avatar_url":"https://avatars2.githubusercontent.com/u/12508754?v=4","gravatar_id":"","url":"https://api.github.com/users/aipan","html_url":"https://github.com/aipan","followers_url":"https://api.github.com/users/aipan/followers","following_url":"https://api.github.com/users/aipan/following{/other_user}","gists_url":"https://api.github.com/users/aipan/gists{/gist_id}","starred_url":"https://api.github.com/users/aipan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aipan/subscriptions","organizations_url":"https://api.github.com/users/aipan/orgs","repos_url":"https://api.github.com/users/aipan/repos","events_url":"https://api.github.com/users/aipan/events{/privacy}","received_events_url":"https://api.github.com/users/aipan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-16T07:15:54Z","updated_at":"2018-11-16T07:15:54Z","closed_at":null,"author_association":"NONE","body":"check方法中：\r\n CyclicBarrier barrier = new CyclicBarrier(stats.size() + 1);\r\n创建了stats.size() + 1屏障\r\n但是只创建线程池，线程数量为3\r\n//创建线程池\r\n            int threadSize = 3;\r\n            ExecutorService service = Executors.newFixedThreadPool(threadSize);\r\n\r\n\r\n            for (DTaskStat stat : stats) {\r\n                service.submit(new Runnable() {\r\n                    @Override\r\n                    public void run() {\r\n                        //执行任务\r\n                        try {\r\n                            alerter.check(dataConsumer, dataLoader, stat, getCheckMeta(work, stat.getSchema(), stat.getTable()), work.getReceivers());\r\n                        } finally {\r\n                            try {\r\n                                barrier.await();\r\n                            } catch (Exception e) {\r\n                                e.printStackTrace();\r\n                            }\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n分配告警检查任务到线程池子中，提交3个任务后，barrier.await();就在等待了，该任务没结束，然后线程池不能继续提交剩下的代码，所以导致线程卡在这。"}}
{"actor":{"display_login":"aipan"}}