{"id":7488,"date":"2021-11-15T11:00:31","date_gmt":"2021-11-15T02:00:31","guid":{"rendered":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/?p=7488"},"modified":"2021-12-01T14:33:40","modified_gmt":"2021-12-01T05:33:40","slug":"%e8%a4%87%e6%95%b0%e3%82%b9%e3%83%ac%e3%83%83%e3%83%89%e3%81%a7%e5%b9%b3%e8%a1%8c%e5%87%a6%e7%90%86%e3%81%97%e3%80%81%e9%a0%86%e5%ba%8f%e3%81%9d%e3%81%ae%e3%81%be%e3%81%be%e3%81%a7%e7%b5%90%e6%9e%9c","status":"publish","type":"post","link":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/7488","title":{"rendered":"\u8907\u6570\u30b9\u30ec\u30c3\u30c9\u3067\u5e73\u884c\u51e6\u7406\u3057\u3001\u9806\u5e8f\u305d\u306e\u307e\u307e\u3067\u7d50\u679c\u3092\u683c\u7d0d\u3059\u308b"},"content":{"rendered":"<div class=\"veu_autoEyeCatchBox\"><img loading=\"lazy\" decoding=\"async\" width=\"565\" height=\"565\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2021\/11\/thumbnail_1112.jpg\" class=\"attachment-large size-large wp-post-image\" alt=\"\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2021\/11\/thumbnail_1112.jpg 565w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2021\/11\/thumbnail_1112-300x300.jpg 300w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2021\/11\/thumbnail_1112-150x150.jpg 150w\" sizes=\"auto, (max-width: 565px) 100vw, 565px\" \/><\/div>\n<p>\u3053\u3093\u306b\u3061\u308f\u3001\u732b\u597d\u304d\u30ea\u30fc\u30de\u30f3\u306e\u307b\u3052PG\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u8907\u6570\u30b9\u30ec\u30c3\u30c9\u3067\u5e73\u884c\u51e6\u7406\u3057\u3001\u8981\u6c42\u6642\u306e\u9806\u5e8f\u3067\u7d50\u679c\u3092\u914d\u5217\u306b\u683c\u7d0d\u3059\u308b\u30b3\u30fc\u30c9\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/h3>\n<pre class=\"lang:default highlight:0 decode:true \">import java.util.Arrays;\r\nimport java.util.List;\r\nimport java.util.Random;\r\nimport java.util.concurrent.CountDownLatch;\r\nimport java.util.concurrent.ExecutorService;\r\nimport java.util.concurrent.Executors;\r\nimport java.util.stream.Collectors;\r\n\r\npublic class Hoge {\r\n\r\n    public static void main(String[] args) throws Exception {\r\n        log(\"start ...\");\r\n        ExecutorService streamPool = Executors.newFixedThreadPool(10);  \/\/\u2460\r\n        List&lt;String&gt; requests = Arrays.asList(new String[] {\"11\", \"22\", \"33\", \"44\", \"55\"});  \/\/\u2461\r\n        String[] array = new String[requests.size()];  \/\/\u2462\r\n        try {\r\n            CountDownLatch latch = new CountDownLatch(requests.size());  \/\/\u2463\r\n            int i = 0;\r\n            for (String val : requests) {\r\n                Integer x = i++;           \/\/\u2464\r\n                streamPool.submit(() -&gt; {  \/\/\u2465\r\n                    log(\"start...\" + x);\r\n                    try {\r\n                        array[x] = doHoge(val);  \/\/\u2466\r\n                    } catch (Exception e) {\r\n                        log(e.toString());\r\n                    } finally {\r\n                        latch.countDown();\r\n                    }\r\n                    log(\"end...\" + x);\r\n                });\r\n            }\r\n            latch.await();\r\n        } finally {\r\n            streamPool.shutdown();\r\n        }\r\n        List&lt;String&gt; results = Arrays.stream(array)\r\n        .filter(pi -&gt; pi != null)       \/\/\u2467\r\n        .collect(Collectors.toList());  \/\/\u2468\r\n        log(results.toString());\r\n        log(\"end ...\");\r\n    }\r\n\r\n    static Random rand = new Random();\r\n    static String doHoge(String v) throws InterruptedException {\r\n        if (\"44\".equals(v)) throw new RuntimeException(\"test\");\r\n        int n = rand.nextInt(10);\r\n        Thread.sleep(n * 1000);\r\n        return v + \"-\" + n;\r\n    }\r\n    public static void log(String msg) {\r\n        System.out.println(msg);\r\n    }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u89e3\u8aac<\/h3>\n<ol>\n<li>\u30b9\u30ec\u30c3\u30c9\u30d7\u30fc\u30eb\u306e\u4f5c\u6210\u3002\u3068\u308a\u3042\u3048\u305a\uff11\uff10\u30b9\u30ec\u30c3\u30c9\u3002<\/li>\n<li>\u30ea\u30af\u30a8\u30b9\u30c8\u30c7\u30fc\u30bf\u3002\u3053\u306e\u9806\u5e8f\u306e\u7d50\u679c\u3092\u683c\u7d0d\u3059\u308b\u3002<\/li>\n<li>\u30b9\u30ec\u30c3\u30c9\u306e\u51e6\u7406\u7d50\u679c\u3092\u683c\u7d0d\u3059\u308b\u914d\u5217\u3002<\/li>\n<li>\u30b9\u30ec\u30c3\u30c9\u306e\u5f85\u3061\u5408\u308f\u305b\u7528\u3002<\/li>\n<li>\u30b9\u30ec\u30c3\u30c9\u306e\u7d50\u679c\u3092\u683c\u7d0d\u3059\u308b\u305f\u3081\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3002\u30b9\u30ec\u30c3\u30c9\u304b\u3089\u89e6\u308c\u308b\u3088\u3046\u306bInteger\u3067\u5b9a\u7fa9\u3002<\/li>\n<li>\u30b9\u30ec\u30c3\u30c9\u547c\u51fa\u3002<\/li>\n<li>\u7d50\u679c\u3092\u2462\u306e\u914d\u5217\u306b\u683c\u7d0d\u3002<\/li>\n<li>\u7d50\u679c\u306bnull\u306e\u5834\u5408\u306f\u8a70\u3081\u308b\u3002<\/li>\n<li>List\u306b\u5909\u63db\u3002<\/li>\n<\/ol>\n<p>\u30dd\u30a4\u30f3\u30c8\u306f\u30b9\u30ec\u30c3\u30c9\u306e\u51e6\u7406\u7d50\u679c\u3092\u914d\u5217\u306b\u683c\u7d0d\u3057\u3001\u6700\u5f8c\u306bnull\u3092\u9664\u53bb\u3059\u308b\u3060\u3051\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u4eca\u56de\u306f\u3053\u3053\u307e\u3067\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7489\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2021\/11\/thumbnail_1112.jpg\" alt=\"\" width=\"565\" height=\"565\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2021\/11\/thumbnail_1112.jpg 565w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2021\/11\/thumbnail_1112-300x300.jpg 300w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2021\/11\/thumbnail_1112-150x150.jpg 150w\" sizes=\"auto, (max-width: 565px) 100vw, 565px\" \/><\/p>\n<hr \/>\n<p>\u25c6WEB\u4f1a\u8b70\uff0f\u30bb\u30df\u30ca\u30fc\u30b7\u30b9\u30c6\u30e0\u300eSzia\u300f<br \/>\n<a href=\"https:\/\/www.ois-yokohama.co.jp\/szia\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.ois-yokohama.co.jp\/szia\/<\/a><\/p>\n<p>\u25c6\u30b5\u30fc\u30d0\u30b5\u30a4\u30c9\u3067\u52d5\u4f5c\u3059\u308b\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u300eReDois\u300f<br \/>\n<a href=\"https:\/\/www.ois-yokohama.co.jp\/redois\/wp_redois\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.ois-yokohama.co.jp\/redois\/wp_redois\/<\/a><\/p>\n<p>\u25c6AI\u304c\u30c8\u30ec\u30f3\u30c9\u30c8\u30d4\u30c3\u30af\u3092\u3082\u3068\u306b\u3001\u8aad\u307e\u308c\u305d\u3046\u306a\u8a18\u4e8b\u30bf\u30a4\u30c8\u30eb\u3092\u81ea\u52d5\u751f\u6210\u300eAI Title Maker\u300f<br \/>\n<a href=\"https:\/\/ai-title.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/ai-title.com\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u308f\u3001\u732b\u597d\u304d\u30ea\u30fc\u30de\u30f3\u306e\u307b\u3052PG\u3067\u3059\u3002 \u4eca\u56de\u306f\u8907\u6570\u30b9\u30ec\u30c3\u30c9\u3067\u5e73\u884c\u51e6\u7406\u3057\u3001\u8981\u6c42\u6642\u306e\u9806\u5e8f\u3067\u7d50\u679c\u3092\u914d\u5217\u306b\u683c\u7d0d\u3059\u308b\u30b3\u30fc\u30c9\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 &nbsp; \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9 import java.util.Arrays; impor [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7489,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"vkexunit_cta_each_option":"","footnotes":""},"categories":[6],"tags":[563,967,966,968,969],"class_list":["post-7488","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-engineer","tag-java","tag-967","tag-966","tag-968","tag-969"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/7488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/comments?post=7488"}],"version-history":[{"count":6,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/7488\/revisions"}],"predecessor-version":[{"id":7519,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/7488\/revisions\/7519"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/media\/7489"}],"wp:attachment":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/media?parent=7488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/categories?post=7488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/tags?post=7488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}