{"id":1175,"date":"2016-08-18T17:40:33","date_gmt":"2016-08-18T09:40:33","guid":{"rendered":"http:\/\/www.yeetrack.com\/?p=1175"},"modified":"2016-08-18T23:06:54","modified_gmt":"2016-08-18T15:06:54","slug":"%e8%b5%b0%e8%bf%91guava%e5%9b%9b-%e5%b9%b6%e5%8f%91","status":"publish","type":"post","link":"https:\/\/www.yeetrack.com\/?p=1175","title":{"rendered":"\u8d70\u8fd1Guava(\u56db): \u5e76\u53d1"},"content":{"rendered":"<div class=\"blog-body\">\n<div class=\"BlogContent\">\n<h1>\u5e76\u53d1\uff1a<\/h1>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\">Guava\u96c6\u5408\u5904\u7406\u662f\u5f88\u5f3a\u5927\u7684(\u8fd9\u4e9b\u5728jdk8\u4e2d\u90fd\u6709\u4e9b\u5f15\u5165)\uff0c\u4f46Guava\u53d1\u5149\u7684\u5730\u65b9\u662f<span style=\"color: #e53333; font-size: 14px;\">\u5e76\u53d1<\/span>\u3002<\/span><\/li>\n<\/ul>\n<h2>Monitor<\/h2>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\">Monitor\u5b9e\u73b0\u540c\u6b65<\/span><\/li>\n<\/ul>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>\/**\n * \u901a\u8fc7Monitor\u7684Guard\u8fdb\u884c\u6761\u4ef6\u963b\u585e\n *\/<!--more-->\n\n\npublic class MonitorSample {\n\tprivate List&lt;String&gt; list = new ArrayList&lt;String&gt;();\n\tprivate static final int MAX_SIZE = 10;\n\tprivate Monitor monitor = new Monitor();\n\t\n\tprivate Monitor.Guard listBelowCapacity = new Monitor.Guard(monitor) {\n\t\t@Override\n\t\tpublic boolean isSatisfied() {\n\t\t\treturn list.size() &lt; MAX_SIZE;\n\t\t}\n\t};\n\n\tpublic void addToList(String item) throws InterruptedException {\n\t\tmonitor.enterWhen(listBelowCapacity); \/\/Guard(\u5f62\u5982Condition)\uff0c\u4e0d\u6ee1\u8db3\u5219\u963b\u585e\uff0c\u800c\u4e14\u6211\u4eec\u5e76\u6ca1\u6709\u5728Guard\u8fdb\u884c\u4efb\u4f55\u901a\u77e5\u64cd\u4f5c\n\t\ttry {\n\t\t\tlist.add(item);\n\t\t} finally {\n\t\t\tmonitor.leave();\n\t\t}\n\t}\n}<\/code><\/pre>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\"><span style=\"color: #e53333; font-size: 16px;\">Monitor<\/span>\u5c31\u50cfjava\u672c\u571f\u7684<span style=\"color: #e53333; font-size: 16px;\">synchronized<\/span>, <span style=\"font-size: 16px; color: #e53333;\">ReentrantLock<\/span>\u4e00\u6837\uff0c\u6bcf\u6b21\u53ea\u8fd0\u884c\u4e00\u4e2a\u7ebf\u7a0b\u5360\u7528\uff0c\u4e14\u53ef\u91cd\u5360\u7528\uff0c\u6bcf\u4e00\u6b21\u5360\u7528\u4f1a\u5bf9\u5e94\u4e00\u6b21\u9000\u51fa\u5360\u7528\u3002<\/span><\/li>\n<\/ul>\n<h3>Monitor\u6700\u4f73\u5b9e\u8df5\uff1a<\/h3>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\">\u5c31\u5982\u4e0a\u9762\uff0c\u6211\u4eec\u901a\u8fc7if\u6761\u4ef6\u6765\u5224\u65ad\u662f\u5426\u53ef\u8fdb\u5165Monitor\u4ee3\u7801\u5757\uff0c\u5e76\u518dtry\/finally\u4e2d\u91ca\u653e\uff1a<\/span><\/li>\n<\/ul>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>if (monitor.enterIf(guardCondition)) {\n        try {\n              doWork();\n    } finally {\n           monitor.leave();\n       }\n}<\/code><\/pre>\n<h3>\u5176\u4ed6\u7684Monitor\u8bbf\u95ee\u65b9\u6cd5\uff1a<\/h3>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>Monitor.enter \/\/\u8fdb\u5165Monitor\u5757\uff0c\u5c06\u963b\u585e\u5176\u4ed6\u7ebf\u7a0b\u77e5\u9053Monitor.leave\nMonitor.tryEnter \/\/\u5c1d\u8bd5\u8fdb\u5165Monitor\u5757\uff0ctrue\u8868\u793a\u53ef\u4ee5\u8fdb\u5165, false\u8868\u793a\u4e0d\u80fd\uff0c\u5e76\u4e14\u4e0d\u4f1a\u4e00\u76f4\u963b\u585e\nMonitor.tryEnterIf \/\/\u6839\u636e\u6761\u4ef6\u5c1d\u8bd5\u8fdb\u5165Monitor\u5757<\/code><\/pre>\n<p><span style=\"font-size: 12.5px; line-height: 1.5;\">\u8fd9\u4e9b\u65b9\u6cd5\u90fd\u6709\u5bf9\u5e94\u7684\u9650\u65f6\u7248\u672c\u3002<\/span><\/p>\n<h3>ListenableFuture\u7c7b<\/h3>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\">jdk5\u4e4b\u540e\u6709\u4e86Future\u8fd9\u79cd\u5f02\u6b65\u6267\u884c\u7684\u7ed3\u6784<\/span><\/li>\n<\/ul>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>ExecutorService executor = Executors.newCachedThreadPool();\n   Future&lt;Integer&gt; future = executor.submit(new Callable&lt;Integer&gt;(){\n                                public Integer call() throws Exception{\n                                   return service.getCount();\n} });\n\/\/Retrieve the value of computation\nInteger count = future.get();<\/code><\/pre>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\"><span style=\"color: #e53333; font-size: 16px;\">ListenableFuture<\/span>\u5bf9Future\u8fdb\u884c\u4e86\u6269\u5c55\uff0c\u5141\u8bb8\u6ce8\u518c\u4e00\u4e2a\u56de\u8c03\u51fd\u6570\uff0ctask\u6267\u884c\u5b8c\u540e\u81ea\u52a8\u8c03\u7528\u3002<\/span><\/li>\n<\/ul>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\">\u83b7\u53d6<span style=\"color: #e53333; font-size: 16px;\">ListableFuture<\/span>\u5bf9\u8c61\u3002<\/span><\/li>\n<\/ul>\n<p>\u6b63\u5982\u6211\u4eec\u83b7\u53d6Future\u5bf9\u8c61\u8981\u901a\u8fc7ExecutorService.submit(Callable)\u6765\u83b7\u53d6\u4e00\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u8fd9\u6837\u521b\u5efaListenableFuture\u5bf9\u8c61\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS)); \/\/\u5305\u88c5Executors\u521b\u5efa\u7684\u7ebf\u7a0b\u6c60\nListenableFuture&lt;String&gt; listenableFuture = executorService.submit(new Callable&lt;String&gt;()...); \/\/\u83b7\u53d6ListableFuture\u5bf9\u8c61\nlistenableFuture.addListener(new Runnable() {\n      @Override\n      public void run() {\n          methodToRunOnFutureTaskCompletion();\n      }\n}, executorService); \/\/\u6ce8\u518c\u56de\u8c03\u51fd\u6570<\/code><\/pre>\n<h3>FutureCallback\u7c7b<\/h3>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\"><span style=\"color: #e53333; font-size: 16px;\">FutureCallback<\/span>\u5b9a\u4e49\u4e86<span style=\"color: #e53333; font-size: 16px;\">onSuccess<\/span>\u548c<span style=\"color: #e53333; font-size: 16px;\">onFailure<\/span>\u65b9\u6cd5\uff0conSuccess\u65b9\u6cd5\u4f1a\u63a5\u6536\u4e00\u4e2aFuture\u5bf9\u8c61\uff0c\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u83b7\u53d6Future\u7684\u7ed3\u679c\u3002<\/span><\/li>\n<\/ul>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\">\u9996\u5148\u9700\u8981\u4e00\u4e2aFutureCallback\u5b9e\u73b0\u7c7b\u3002<\/span><\/li>\n<\/ul>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>\/**\n * \u5b9a\u4e49\u4e00\u4e2aFutureCallBack\u5b9e\u73b0\u7c7b\n *\/\npublic class FutureCallbackImpl implements FutureCallback&lt;String&gt; {\n\tprivate StringBuilder builder = new StringBuilder();\n\n\t@Override\n\tpublic void onSuccess(String result) {\n\t\tbuilder.append(result).append(\" successfully\");\n\t}\n\n\t@Override\n\tpublic void onFailure(Throwable t) {\n\t\tbuilder.append(t.toString());\n\t}\n\n\tpublic String getCallbackResult() {\n\t\treturn builder.toString();\n\t}\n}<\/code><\/pre>\n<p>\u4f7f\u7528\u5b9e\u4f8b\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());\nListenableFuture&lt;String&gt; futureTask = executorService.submit(new Callable&lt;String&gt;() { \/\/\u521b\u5efaListenaleFuture\u5bf9\u8c61\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic String call() throws Exception {\n\t\t\t\t\t\treturn \"Task completed\";\n\t\t\t\t\t}\n\t\t\t\t});\nFutureCallbackImpl callback = new FutureCallbackImpl();\nFutures.addCallback(futureTask, callback); \/\/\u6dfb\u52a0\u56de\u8c03\ncallback.getCallbackResult(); \/\/\u83b7\u53d6\u7ed3\u679c<\/code><\/pre>\n<p>\u5982\u679cCallBack\u662f\u4e00\u4e2a\u8017\u65f6\u64cd\u4f5c\uff0c\u4f60\u5e94\u8be5\u9009\u62e9\u53e6\u4e00\u4e2a\u6ce8\u518cCallBack:<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>Futures.addCallback(futureTask,callback,executorService); \/\/\u63d0\u4f9b\u53e6\u4e00\u4e2a\u7ebf\u7a0b\u6c60\u6765\u6267\u884c\u6027\u56de\u8c03<\/code><\/pre>\n<h3>SettableFuture\u7c7b\uff1a<\/h3>\n<p><span style=\"font-size: 12.5px; line-height: 1.5;\">SettableFuture\u53ef\u4ee5\u7528\u6765<\/span><span style=\"font-size: 12.5px; line-height: 1.5;\">\u8bbe\u7f6e\u8981\u8fd4\u56de\u5f97\u503c\uff1a<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>SettableFuture&lt;String&gt; sf = SettableFuture.create();\n\/\/Set a value to return\nsf.set(\"Success\");\n\/\/Or set a failure Exception\nsf.setException(someException);<\/code><\/pre>\n<h3><span style=\"font-size: 12.5px; line-height: 1.5;\">AsyncFunction\uff1a<\/span><\/h3>\n<ul>\n<li><span style=\"font-size: 12.5px; line-height: 1.5;\">\u8be5\u63a5\u53e3\u4e0e<span style=\"color: #e53333; font-size: 16px;\">\u51fd\u6570\u5f0f\u7f16\u7a0b<\/span>\u5bc6\u5207\u76f8\u5173, \u7c7b\u4f3cFunction, \u4f46apply\u65b9\u6cd5\u4f1a\u8f6c\u6362\u6210\u4e00\u4e2a<span style=\"color: #e53333; font-size: 16px;\">ListenableFuture<\/span>\u5c01\u88c5\u7684\u8303\u578b\u5bf9\u8c61\u3002<\/span><\/li>\n<\/ul>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>public class AsyncFuntionSample implements AsyncFunction&lt;Long, String&gt; {\n\tprivate ConcurrentMap&lt;Long, String&gt; map = Maps.newConcurrentMap();\n\tprivate ListeningExecutorService listeningExecutorService;\n\n\t@Override\n\tpublic ListenableFuture&lt;String&gt; apply(final Long input) throws Exception {\n\t\tif (map.containsKey(input)) {\n\t\t\tSettableFuture&lt;String&gt; listenableFuture = SettableFuture.create(); \/\/\u6784\u5efa\u4e00\u4e2aSettableFuture\n\t\t\tlistenableFuture.set(map.get(input));\n\t\t\treturn listenableFuture;\n\t\t} else {\n\t\t\treturn listeningExecutorService.submit(new Callable&lt;String&gt;() {\n\t\t\t\t@Override\n\t\t\t\tpublic String call() throws Exception {\n\t\t\t\t\tString retrieved = \/\/compute to get the data;\n\t\t\t\t\tmap.putIfAbsent(input, retrieved);\n\t\t\t\t\treturn retrieved;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n}<\/code><\/pre>\n<h3>FutureFallback\u7c7b\uff1a<\/h3>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\"><span style=\"color: #e53333; font-size: 16px;\">Futu<\/span><span style=\"color: #e53333; font-size: 16px;\">reFallback<\/span>\u7528\u4e8e\u5f02\u5e38\u6062\u590d\u7684\u5907\u4efd\u3002<\/span><\/li>\n<\/ul>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>\/**\n * \u5f53Future\u4efb\u52a1\u5931\u8d25\u540e, \u4f5c\u4e3a\u5907\u4efd\u7684Future\n *\/\npublic class FutureFallbackImpl implements FutureFallback&lt;String&gt; {\n\t@Override\n\tpublic ListenableFuture&lt;String&gt; create(Throwable t) throws Exception {\n\t\tif (t instanceof FileNotFoundException) {\n\t\t\tSettableFuture&lt;String&gt; settableFuture = SettableFuture.create();\n\t\t\tsettableFuture.set(\"Not Found\");\n\t\t\treturn settableFuture;\n\t\t}\n\t\tthrow new Exception(t);\n\t}\n}<\/code><\/pre>\n<h3>Futures\u7c7b:<\/h3>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\"><span style=\"color: #e53333; font-size: 16px;\">Fut<\/span><span style=\"color: #e53333; font-size: 16px;\">ures<\/span>\u7c7b\u662f\u6709\u5173Future\u5b9e\u4f8b\u7684\u4e00\u4e2a\u5de5\u5177\u7c7b\u3002<\/span><\/li>\n<\/ul>\n<h3>\u5f02\u6b65\u8f6c\u6362\uff1a<\/h3>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>ListenableFuture&lt;Person&gt; lf = Futures.transform(ListenableFuture&lt;String&gt; f,AsyncFunction&lt;String,Person&gt; af);<\/code><\/pre>\n<h3>\u4f7f\u7528FutureFallbacks:<\/h3>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>ListenableFuture&lt;String&gt; lf = Futures.withFallback(ListenableFuture&lt;String&gt; f,FutureFallback&lt;String&gt; fb);<\/code><\/pre>\n<h3>RateLimiter:<\/h3>\n<ul>\n<li><span style=\"line-height: 1.5; font-size: 12.5px;\"><span style=\"color: #e53333; font-size: 16px;\">RateLimi<\/span><span style=\"color: #e53333; font-size: 16px;\">ter<\/span>\u9650\u5236\u8bbf\u95ee\u6bcf\u79d2\u8bbf\u95ee\u8d44\u6e90\u7684\u7ebf\u7a0b\u6570\u3002\u6709\u70b9\u7c7b\u4f3c\u4fe1\u53f7\u91cfSemaphore\u3002<\/span><\/li>\n<\/ul>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>RateLimiter limiter = RateLimiter.create(4.0); \/\/\u6bcf\u79d2\u4e0d\u8d85\u8fc74\u4e2a\u4efb\u52a1\u88ab\u63d0\u4ea4<\/code><\/pre>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>limiter.acquire();  \/\/\u8bf7\u6c42RateLimiter, \u8d85\u8fc7permits\u4f1a\u88ab\u963b\u585e\nexecutor.submit(runnable); \/\/\u63d0\u4ea4\u4efb\u52a1<\/code><\/pre>\n<p>\u4e5f\u6709\u975e\u963b\u585e\u5f0f\u5730\u5c1d\u8bd5\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\"><code>If(limiter.tryAcquire()){ \/\/\u672a\u8bf7\u6c42\u5230limiter\u5219\u7acb\u5373\u8fd4\u56defalse\n    doSomething();\n}else{\n    doSomethingElse();\n}<\/code><\/pre>\n<p>\u6765\u6e90\uff1ahttp:\/\/my.oschina.net\/indestiny\/blog\/219368<\/p>\n<\/div>\n<div class=\"video-container\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"yS0S3ynAaA\"><p><a href=\"https:\/\/www.yeetrack.com\/?p=1171\">\u8d70\u8fd1Guava(\u4e00): \u57fa\u672c\u5de5\u5177<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"\u300a\u8d70\u8fd1Guava(\u4e00): \u57fa\u672c\u5de5\u5177\u300b\u2014\u7a7a\u7a7a\u535a\u5ba2\" src=\"https:\/\/www.yeetrack.com\/?p=1171&#038;embed=true#?secret=NRE1Xkeixr#?secret=yS0S3ynAaA\" data-secret=\"yS0S3ynAaA\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<div class=\"video-container\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"pZfK1Dcz60\"><p><a href=\"https:\/\/www.yeetrack.com\/?p=1173\">\u8d70\u8fd1Guava(\u4e8c): \u51fd\u6570\u5f0f\u7f16\u7a0b<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"\u300a\u8d70\u8fd1Guava(\u4e8c): \u51fd\u6570\u5f0f\u7f16\u7a0b\u300b\u2014\u7a7a\u7a7a\u535a\u5ba2\" src=\"https:\/\/www.yeetrack.com\/?p=1173&#038;embed=true#?secret=0DHqAQ9VWX#?secret=pZfK1Dcz60\" data-secret=\"pZfK1Dcz60\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<div class=\"video-container\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"QZvJPToSOL\"><p><a href=\"https:\/\/www.yeetrack.com\/?p=1174\">\u8d70\u8fd1Guava(\u4e09): \u96c6\u5408<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"\u300a\u8d70\u8fd1Guava(\u4e09): \u96c6\u5408\u300b\u2014\u7a7a\u7a7a\u535a\u5ba2\" src=\"https:\/\/www.yeetrack.com\/?p=1174&#038;embed=true#?secret=QNs8Nvpxj0#?secret=QZvJPToSOL\" data-secret=\"QZvJPToSOL\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<div class=\"video-container\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"g9zQ2ggxft\"><p><a href=\"https:\/\/www.yeetrack.com\/?p=1175\">\u8d70\u8fd1Guava(\u56db): \u5e76\u53d1<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"\u300a\u8d70\u8fd1Guava(\u56db): \u5e76\u53d1\u300b\u2014\u7a7a\u7a7a\u535a\u5ba2\" src=\"https:\/\/www.yeetrack.com\/?p=1175&#038;embed=true#?secret=wRZF8OGQHf#?secret=g9zQ2ggxft\" data-secret=\"g9zQ2ggxft\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<div class=\"video-container\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"Kgv3HGHebI\"><p><a href=\"https:\/\/www.yeetrack.com\/?p=1176\">\u8d70\u8fd1Guava(\u4e94): \u7f13\u5b58<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"\u300a\u8d70\u8fd1Guava(\u4e94): \u7f13\u5b58\u300b\u2014\u7a7a\u7a7a\u535a\u5ba2\" src=\"https:\/\/www.yeetrack.com\/?p=1176&#038;embed=true#?secret=0zilkTRuaV#?secret=Kgv3HGHebI\" data-secret=\"Kgv3HGHebI\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<div class=\"video-container\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"2S6drQzb1c\"><p><a href=\"https:\/\/www.yeetrack.com\/?p=1177\">\u8d70\u8fd1Guava(\u516d): \u4e8b\u4ef6\u603b\u7ebfEventBus<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"\u300a\u8d70\u8fd1Guava(\u516d): \u4e8b\u4ef6\u603b\u7ebfEventBus\u300b\u2014\u7a7a\u7a7a\u535a\u5ba2\" src=\"https:\/\/www.yeetrack.com\/?p=1177&#038;embed=true#?secret=4fpF3pt81d#?secret=2S6drQzb1c\" data-secret=\"2S6drQzb1c\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<div class=\"video-container\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"xjiBKG5Han\"><p><a href=\"https:\/\/www.yeetrack.com\/?p=1178\">\u8d70\u8fd1Guava(\u4e03): \u6587\u4ef6\u64cd\u4f5c<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"\u300a\u8d70\u8fd1Guava(\u4e03): \u6587\u4ef6\u64cd\u4f5c\u300b\u2014\u7a7a\u7a7a\u535a\u5ba2\" src=\"https:\/\/www.yeetrack.com\/?p=1178&#038;embed=true#?secret=fPYGZLPypW#?secret=xjiBKG5Han\" data-secret=\"xjiBKG5Han\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5e76\u53d1\uff1a Guava\u96c6\u5408\u5904\u7406\u662f\u5f88\u5f3a\u5927\u7684(\u8fd9\u4e9b\u5728jdk8\u4e2d\u90fd\u6709\u4e9b\u5f15\u5165)\uff0c\u4f46Guava\u53d1\u5149\u7684\u5730\u65b9\u662f\u5e76\u53d1\u3002 Monitor Monitor\u5b9e\u73b0\u540c\u6b65 \/** * \u901a\u8fc7Monitor\u7684Guard\u8fdb\u884c\u6761\u4ef6\u963b\u585e *\/<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pgc_sgb_lightbox_settings":"","footnotes":""},"categories":[33],"tags":[65,8],"class_list":["post-1175","post","type-post","status-publish","format-standard","hentry","category-coding","tag-guava","tag-java"],"views":4541,"_links":{"self":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1175"}],"version-history":[{"count":1,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1175\/revisions"}],"predecessor-version":[{"id":1188,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1175\/revisions\/1188"}],"wp:attachment":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}