{"id":2241,"date":"2018-02-09T16:50:47","date_gmt":"2018-02-09T08:50:47","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=2241"},"modified":"2018-02-09T16:59:33","modified_gmt":"2018-02-09T08:59:33","slug":"java8%e6%96%b0%e7%9a%84%e5%bc%82%e6%ad%a5%e7%bc%96%e7%a8%8b%e6%96%b9%e5%bc%8f-completablefuture%e4%b8%80","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=2241","title":{"rendered":"Java8\u65b0\u7684\u5f02\u6b65\u7f16\u7a0b\u65b9\u5f0f CompletableFuture(\u4e00)"},"content":{"rendered":"<div>\n<h1>\u4e00. Future<\/h1>\n<p>JDK 5\u5f15\u5165\u4e86Future\u6a21\u5f0f\u3002Future\u63a5\u53e3\u662fJava\u591a\u7ebf\u7a0bFuture\u6a21\u5f0f\u7684\u5b9e\u73b0\uff0c\u5728java.util.concurrent\u5305\u4e2d\uff0c\u53ef\u4ee5\u6765\u8fdb\u884c\u5f02\u6b65\u8ba1\u7b97\u3002<\/p>\n<p>Future\u6a21\u5f0f\u662f\u591a\u7ebf\u7a0b\u8bbe\u8ba1\u5e38\u7528\u7684\u4e00\u79cd\u8bbe\u8ba1\u6a21\u5f0f\u3002Future\u6a21\u5f0f\u53ef\u4ee5\u7406\u89e3\u6210\uff1a\u6211\u6709\u4e00\u4e2a\u4efb\u52a1\uff0c\u63d0\u4ea4\u7ed9\u4e86Future\uff0cFuture\u66ff\u6211\u5b8c\u6210\u8fd9\u4e2a\u4efb\u52a1\u3002\u671f\u95f4\u6211\u81ea\u5df1\u53ef\u4ee5\u53bb\u505a\u4efb\u4f55\u60f3\u505a\u7684\u4e8b\u60c5\u3002\u4e00\u6bb5\u65f6\u95f4\u4e4b\u540e\uff0c\u6211\u5c31\u4fbf\u53ef\u4ee5\u4eceFuture\u90a3\u513f\u53d6\u51fa\u7ed3\u679c\u3002<\/p>\n<p>Future\u7684\u63a5\u53e3\u5f88\u7b80\u5355\uff0c\u53ea\u6709\u4e94\u4e2a\u65b9\u6cd5\u3002<\/p>\n<pre class=\"hljs java\"><code class=\"java\"><span class=\"hljs-keyword\">public<\/span> <span class=\"hljs-class\"><span class=\"hljs-keyword\">interface<\/span> <span class=\"hljs-title\">Future<\/span>&lt;<span class=\"hljs-title\">V<\/span>&gt; <\/span>{\r\n\r\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">boolean<\/span> <span class=\"hljs-title\">cancel<\/span><span class=\"hljs-params\">(<span class=\"hljs-keyword\">boolean<\/span> mayInterruptIfRunning)<\/span><\/span>;\r\n\r\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">boolean<\/span> <span class=\"hljs-title\">isCancelled<\/span><span class=\"hljs-params\">()<\/span><\/span>;\r\n\r\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">boolean<\/span> <span class=\"hljs-title\">isDone<\/span><span class=\"hljs-params\">()<\/span><\/span>;\r\n\r\n    <span class=\"hljs-function\">V <span class=\"hljs-title\">get<\/span><span class=\"hljs-params\">()<\/span> <span class=\"hljs-keyword\">throws<\/span> InterruptedException, ExecutionException<\/span>;\r\n\r\n    <span class=\"hljs-function\">V <span class=\"hljs-title\">get<\/span><span class=\"hljs-params\">(<span class=\"hljs-keyword\">long<\/span> timeout, TimeUnit unit)<\/span>\r\n        <span class=\"hljs-keyword\">throws<\/span> InterruptedException, ExecutionException, TimeoutException<\/span>;\r\n}\r\n<\/code><\/pre>\n<p>Future\u63a5\u53e3\u7684\u65b9\u6cd5\u4ecb\u7ecd\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>boolean cancel (boolean mayInterruptIfRunning) \u53d6\u6d88\u4efb\u52a1\u7684\u6267\u884c\u3002\u53c2\u6570\u6307\u5b9a\u662f\u5426\u7acb\u5373\u4e2d\u65ad\u4efb\u52a1\u6267\u884c\uff0c\u6216\u8005\u7b49\u7b49\u4efb\u52a1\u7ed3\u675f<\/li>\n<li>boolean isCancelled () \u4efb\u52a1\u662f\u5426\u5df2\u7ecf\u53d6\u6d88\uff0c\u4efb\u52a1\u6b63\u5e38\u5b8c\u6210\u524d\u5c06\u5176\u53d6\u6d88\uff0c\u5219\u8fd4\u56de true<\/li>\n<li>boolean isDone () \u4efb\u52a1\u662f\u5426\u5df2\u7ecf\u5b8c\u6210\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\u5982\u679c\u4efb\u52a1\u6b63\u5e38\u7ec8\u6b62\u3001\u5f02\u5e38\u6216\u53d6\u6d88\uff0c\u90fd\u5c06\u8fd4\u56detrue<\/li>\n<li>V get () throws InterruptedException, ExecutionException \u7b49\u5f85\u4efb\u52a1\u6267\u884c\u7ed3\u675f\uff0c\u7136\u540e\u83b7\u5f97V\u7c7b\u578b\u7684\u7ed3\u679c\u3002InterruptedException \u7ebf\u7a0b\u88ab\u4e2d\u65ad\u5f02\u5e38\uff0c ExecutionException\u4efb\u52a1\u6267\u884c\u5f02\u5e38\uff0c\u5982\u679c\u4efb\u52a1\u88ab\u53d6\u6d88\uff0c\u8fd8\u4f1a\u629b\u51faCancellationException<\/li>\n<li>V get (long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException \u540c\u4e0a\u9762\u7684get\u529f\u80fd\u4e00\u6837\uff0c\u591a\u4e86\u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4\u3002\u53c2\u6570timeout\u6307\u5b9a\u8d85\u65f6\u65f6\u95f4\uff0cuint\u6307\u5b9a\u65f6\u95f4\u7684\u5355\u4f4d\uff0c\u5728\u679a\u4e3e\u7c7bTimeUnit\u4e2d\u6709\u76f8\u5173\u7684\u5b9a\u4e49\u3002\u5982\u679c\u8ba1 \u7b97\u8d85\u65f6\uff0c\u5c06\u629b\u51faTimeoutException<\/li>\n<\/ul>\n<p>\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u4f1a\u7ed3\u5408Callable\u548cFuture\u4e00\u8d77\u4f7f\u7528\uff0c\u901a\u8fc7ExecutorService\u7684submit\u65b9\u6cd5\u6267\u884cCallable\uff0c\u5e76\u8fd4\u56deFuture\u3002<\/p>\n<pre class=\"hljs java\"><code class=\"java\">        ExecutorService executor = Executors.newCachedThreadPool();\r\n\r\n        Future&lt;String&gt; future = executor.submit(() -&gt; { <span class=\"hljs-comment\">\/\/Lambda \u662f\u4e00\u4e2a callable\uff0c \u63d0\u4ea4\u540e\u4fbf\u7acb\u5373\u6267\u884c\uff0c\u8fd9\u91cc\u8fd4\u56de\u7684\u662f FutureTask \u5b9e\u4f8b<\/span>\r\n            System.out.println(<span class=\"hljs-string\">\"running task\"<\/span>);\r\n            Thread.sleep(<span class=\"hljs-number\">10000<\/span>);\r\n            <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-string\">\"return task\"<\/span>;\r\n        });\r\n\r\n        <span class=\"hljs-keyword\">try<\/span> {\r\n            Thread.sleep(<span class=\"hljs-number\">1000<\/span>);\r\n        } <span class=\"hljs-keyword\">catch<\/span> (InterruptedException e) {\r\n        }\r\n\r\n        System.out.println(<span class=\"hljs-string\">\"do something else\"<\/span>);  <span class=\"hljs-comment\">\/\/\u524d\u9762\u7684\u7684 Callable \u5728\u5176\u4ed6\u7ebf\u7a0b\u4e2d\u8fd0\u884c\u7740\uff0c\u53ef\u4ee5\u505a\u4e00\u4e9b\u5176\u4ed6\u7684\u4e8b\u60c5<\/span>\r\n\r\n        <span class=\"hljs-keyword\">try<\/span> {\r\n            System.out.println(future.get());  <span class=\"hljs-comment\">\/\/\u7b49\u5f85 future \u7684\u6267\u884c\u7ed3\u679c\uff0c\u6267\u884c\u5b8c\u6bd5\u4e4b\u540e\u6253\u5370\u51fa\u6765<\/span>\r\n        } <span class=\"hljs-keyword\">catch<\/span> (InterruptedException e) {\r\n        } <span class=\"hljs-keyword\">catch<\/span> (ExecutionException e) {\r\n\r\n        } <span class=\"hljs-keyword\">finally<\/span> {\r\n            executor.shutdown();\r\n        }\r\n<\/code><\/pre>\n<blockquote><p>\u6bd4\u8d77future.get()\uff0c\u5176\u5b9e\u66f4\u63a8\u8350\u4f7f\u7528get (long timeout, TimeUnit unit) \u65b9\u6cd5\uff0c\u8bbe\u7f6e\u4e86\u8d85\u65f6\u65f6\u95f4\u53ef\u4ee5\u9632\u6b62\u7a0b\u5e8f\u65e0\u9650\u5236\u7684\u7b49\u5f85future\u7684\u7ed3\u679c\u3002<\/p><\/blockquote>\n<h1>\u4e8c. CompletableFuture\u4ecb\u7ecd<\/h1>\n<h2>2.1 Future\u6a21\u5f0f\u7684\u7f3a\u70b9<\/h2>\n<ul>\n<li>Future\u867d\u7136\u53ef\u4ee5\u5b9e\u73b0\u83b7\u53d6\u5f02\u6b65\u6267\u884c\u7ed3\u679c\u7684\u9700\u6c42\uff0c\u4f46\u662f\u5b83\u6ca1\u6709\u63d0\u4f9b\u901a\u77e5\u7684\u673a\u5236\uff0c\u6211\u4eec\u65e0\u6cd5\u5f97\u77e5Future\u4ec0\u4e48\u65f6\u5019\u5b8c\u6210\u3002<\/li>\n<li>\u8981\u4e48\u4f7f\u7528\u963b\u585e\uff0c\u5728future.get()\u7684\u5730\u65b9\u7b49\u5f85future\u8fd4\u56de\u7684\u7ed3\u679c\uff0c\u8fd9\u65f6\u53c8\u53d8\u6210\u540c\u6b65\u64cd\u4f5c\u3002\u8981\u4e48\u4f7f\u7528isDone()\u8f6e\u8be2\u5730\u5224\u65adFuture\u662f\u5426\u5b8c\u6210\uff0c\u8fd9\u6837\u4f1a\u8017\u8d39CPU\u7684\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<h2>2.2 CompletableFuture\u4ecb\u7ecd<\/h2>\n<p>Netty\u3001Guava\u5206\u522b\u6269\u5c55\u4e86Java \u7684 Future \u63a5\u53e3\uff0c\u65b9\u4fbf\u5f02\u6b65\u7f16\u7a0b\u3002<\/p>\n<p>Java 8\u65b0\u589e\u7684CompletableFuture\u7c7b\u6b63\u662f\u5438\u6536\u4e86\u6240\u6709Google Guava\u4e2dListenableFuture\u548cSettableFuture\u7684\u7279\u5f81\uff0c\u8fd8\u63d0\u4f9b\u4e86\u5176\u5b83\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u8ba9Java\u62e5\u6709\u4e86\u5b8c\u6574\u7684\u975e\u963b\u585e\u7f16\u7a0b\u6a21\u578b\uff1aFuture\u3001Promise \u548c Callback(\u5728Java8\u4e4b\u524d\uff0c\u53ea\u6709\u65e0Callback \u7684Future)\u3002<\/p>\n<p>CompletableFuture\u80fd\u591f\u5c06\u56de\u8c03\u653e\u5230\u4e0e\u4efb\u52a1\u4e0d\u540c\u7684\u7ebf\u7a0b\u4e2d\u6267\u884c\uff0c\u4e5f\u80fd\u5c06\u56de\u8c03\u4f5c\u4e3a\u7ee7\u7eed\u6267\u884c\u7684\u540c\u6b65\u51fd\u6570\uff0c\u5728\u4e0e\u4efb\u52a1\u76f8\u540c\u7684\u7ebf\u7a0b\u4e2d\u6267\u884c\u3002\u5b83\u907f\u514d\u4e86\u4f20\u7edf\u56de\u8c03\u6700\u5927\u7684\u95ee\u9898\uff0c\u90a3\u5c31\u662f\u80fd\u591f\u5c06\u63a7\u5236\u6d41\u5206\u79bb\u5230\u4e0d\u540c\u7684\u4e8b\u4ef6\u5904\u7406\u5668\u4e2d\u3002<\/p>\n<p>CompletableFuture\u5f25\u8865\u4e86Future\u6a21\u5f0f\u7684\u7f3a\u70b9\u3002\u5728\u5f02\u6b65\u7684\u4efb\u52a1\u5b8c\u6210\u540e\uff0c\u9700\u8981\u7528\u5176\u7ed3\u679c\u7ee7\u7eed\u64cd\u4f5c\u65f6\uff0c\u65e0\u9700\u7b49\u5f85\u3002\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7thenAccept\u3001thenApply\u3001thenCompose\u7b49\u65b9\u5f0f\u5c06\u524d\u9762\u5f02\u6b65\u5904\u7406\u7684\u7ed3\u679c\u4ea4\u7ed9\u53e6\u5916\u4e00\u4e2a\u5f02\u6b65\u4e8b\u4ef6\u5904\u7406\u7ebf\u7a0b\u6765\u5904\u7406\u3002<\/p>\n<h1>\u4e09. CompletableFuture\u7279\u6027<\/h1>\n<h2>3.1 CompletableFuture\u7684\u9759\u6001\u5de5\u5382\u65b9\u6cd5<\/h2>\n<p><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2018\/02\/completablefutrue.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2243\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2018\/02\/completablefutrue.png\" alt=\"completablefutrue\" width=\"631\" height=\"276\" \/><\/a><br \/>\nCompletableFuture&lt;Void&gt; future = CompletableFuture.runAsync(() -&gt; {runAsync \u548c supplyAsync \u65b9\u6cd5\u7684\u533a\u522b\u662frunAsync\u8fd4\u56de\u7684CompletableFuture\u662f\u6ca1\u6709\u8fd4\u56de\u503c\u7684\u3002<\/p>\n<pre class=\"hljs java\"><code class=\"java\">            System.out.println(<span class=\"hljs-string\">\"Hello\"<\/span>);\r\n        });\r\n\r\n        <span class=\"hljs-keyword\">try<\/span> {\r\n            future.get();\r\n        } <span class=\"hljs-keyword\">catch<\/span> (InterruptedException e) {\r\n            e.printStackTrace();\r\n        } <span class=\"hljs-keyword\">catch<\/span> (ExecutionException e) {\r\n            e.printStackTrace();\r\n        }\r\n\r\n        System.out.println(<span class=\"hljs-string\">\"CompletableFuture\"<\/span>);\r\n<\/code><\/pre>\n<p>\u800csupplyAsync\u8fd4\u56de\u7684CompletableFuture\u662f\u7531\u8fd4\u56de\u503c\u7684\uff0c\u4e0b\u9762\u7684\u4ee3\u7801\u6253\u5370\u4e86future\u7684\u8fd4\u56de\u503c\u3002<\/p>\n<pre class=\"hljs java\"><code class=\"java\">        CompletableFuture&lt;String&gt; future = CompletableFuture.supplyAsync(() -&gt; <span class=\"hljs-string\">\"Hello\"<\/span>);\r\n\r\n        <span class=\"hljs-keyword\">try<\/span> {\r\n            System.out.println(future.get());\r\n        } <span class=\"hljs-keyword\">catch<\/span> (InterruptedException e) {\r\n            e.printStackTrace();\r\n        } <span class=\"hljs-keyword\">catch<\/span> (ExecutionException e) {\r\n            e.printStackTrace();\r\n        }\r\n\r\n        System.out.println(<span class=\"hljs-string\">\"CompletableFuture\"<\/span>);\r\n<\/code><\/pre>\n<h2>3.2 Completable<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u65b9\u6cd5\u540d<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>complete(T t)<\/td>\n<td>\u5b8c\u6210\u5f02\u6b65\u6267\u884c\uff0c\u5e76\u8fd4\u56defuture\u7684\u7ed3\u679c<\/td>\n<\/tr>\n<tr>\n<td>completeExceptionally(Throwable ex)<\/td>\n<td>\u5f02\u6b65\u6267\u884c\u4e0d\u6b63\u5e38\u7684\u7ed3\u675f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>future.get()\u5728\u7b49\u5f85\u6267\u884c\u7ed3\u679c\u65f6\uff0c\u7a0b\u5e8f\u4f1a\u4e00\u76f4block\uff0c\u5982\u679c\u6b64\u65f6\u8c03\u7528complete(T t)\u4f1a\u7acb\u5373\u6267\u884c\u3002<\/p>\n<pre class=\"hljs java\"><code class=\"java\">        CompletableFuture&lt;String&gt; future  = CompletableFuture.supplyAsync(() -&gt; <span class=\"hljs-string\">\"Hello\"<\/span>);\r\n\r\n        future.complete(<span class=\"hljs-string\">\"World\"<\/span>);\r\n\r\n        <span class=\"hljs-keyword\">try<\/span> {\r\n            System.out.println(future.get());\r\n        } <span class=\"hljs-keyword\">catch<\/span> (InterruptedException e) {\r\n            e.printStackTrace();\r\n        } <span class=\"hljs-keyword\">catch<\/span> (ExecutionException e) {\r\n            e.printStackTrace();\r\n        }\r\n<\/code><\/pre>\n<p>\u6267\u884c\u7ed3\u679c\uff1a<\/p>\n<pre class=\"hljs java\"><code class=\"java\">World\r\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230future\u8c03\u7528complete(T t)\u4f1a\u7acb\u5373\u6267\u884c\u3002\u4f46\u662fcomplete(T t)\u53ea\u80fd\u8c03\u7528\u4e00\u6b21\uff0c\u540e\u7eed\u7684\u91cd\u590d\u8c03\u7528\u4f1a\u5931\u6548\u3002<\/p>\n<p>\u5982\u679cfuture\u5df2\u7ecf\u6267\u884c\u5b8c\u6bd5\u80fd\u591f\u8fd4\u56de\u7ed3\u679c\uff0c\u6b64\u65f6\u518d\u8c03\u7528complete(T t)\u5219\u4f1a\u65e0\u6548\u3002<\/p>\n<pre class=\"hljs java\"><code class=\"java\">        CompletableFuture&lt;String&gt; future = CompletableFuture.supplyAsync(() -&gt; <span class=\"hljs-string\">\"Hello\"<\/span>);\r\n\r\n        <span class=\"hljs-keyword\">try<\/span> {\r\n            Thread.sleep(<span class=\"hljs-number\">5000<\/span>);\r\n        } <span class=\"hljs-keyword\">catch<\/span> (InterruptedException e) {\r\n            e.printStackTrace();\r\n        }\r\n\r\n        future.complete(<span class=\"hljs-string\">\"World\"<\/span>);\r\n\r\n        <span class=\"hljs-keyword\">try<\/span> {\r\n            System.out.println(future.get());\r\n        } <span class=\"hljs-keyword\">catch<\/span> (InterruptedException e) {\r\n            e.printStackTrace();\r\n        } <span class=\"hljs-keyword\">catch<\/span> (ExecutionException e) {\r\n            e.printStackTrace();\r\n        }\r\n<\/code><\/pre>\n<p>\u6267\u884c\u7ed3\u679c\uff1a<\/p>\n<pre class=\"hljs java\"><code class=\"java\">Hello\r\n<\/code><\/pre>\n<p>\u5982\u679c\u4f7f\u7528completeExceptionally(Throwable ex)\u5219\u629b\u51fa\u4e00\u4e2a\u5f02\u5e38\uff0c\u800c\u4e0d\u662f\u4e00\u4e2a\u6210\u529f\u7684\u7ed3\u679c\u3002<\/p>\n<pre class=\"hljs java\"><code class=\"java\">        CompletableFuture&lt;String&gt; future = CompletableFuture.supplyAsync(() -&gt; <span class=\"hljs-string\">\"Hello\"<\/span>);\r\n\r\n        future.completeExceptionally(<span class=\"hljs-keyword\">new<\/span> Exception());\r\n\r\n        <span class=\"hljs-keyword\">try<\/span> {\r\n            System.out.println(future.get());\r\n        } <span class=\"hljs-keyword\">catch<\/span> (InterruptedException e) {\r\n            e.printStackTrace();\r\n        } <span class=\"hljs-keyword\">catch<\/span> (ExecutionException e) {\r\n            e.printStackTrace();\r\n        }\r\n<\/code><\/pre>\n<p>\u6267\u884c\u7ed3\u679c\uff1a<\/p>\n<pre class=\"hljs java\"><code class=\"java\">java.util.concurrent.ExecutionException: java.lang.Exception\r\n...<\/code><\/pre>\n<\/div>\n<p>\u539f\u6587\u7cfb\u5217:<\/p>\n<p><a href=\"https:\/\/www.jianshu.com\/p\/dff9063e1ab6\" target=\"_blank\">Java8\u65b0\u7684\u5f02\u6b65\u7f16\u7a0b\u65b9\u5f0f CompletableFuture(\u4e00)<\/a><\/p>\n<p><a href=\"https:\/\/www.jianshu.com\/p\/d81cf0beb858\" target=\"_blank\">Java8\u65b0\u7684\u5f02\u6b65\u7f16\u7a0b\u65b9\u5f0f CompletableFuture(\u4e8c)<\/a><\/p>\n<p><a class=\"title\" href=\"https:\/\/www.jianshu.com\/p\/807e6822292a?utm_campaign=maleskine&amp;utm_content=note&amp;utm_medium=pc_all_hots&amp;utm_source=recommendation\" target=\"_blank\">Java8\u65b0\u7684\u5f02\u6b65\u7f16\u7a0b\u65b9\u5f0f CompletableFuture(\u4e09)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00. Future JDK 5\u5f15\u5165\u4e86Future\u6a21\u5f0f\u3002Future\u63a5\u53e3\u662fJava\u591a\u7ebf\u7a0bFuture\u6a21\u5f0f\u7684\u5b9e\u73b0\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[103],"tags":[],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2241"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2241"}],"version-history":[{"count":5,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2241\/revisions"}],"predecessor-version":[{"id":2247,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2241\/revisions\/2247"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}