{"id":289,"date":"2021-12-29T04:45:39","date_gmt":"2021-12-29T04:45:39","guid":{"rendered":"https:\/\/datmt.com\/?p=289"},"modified":"2022-03-25T04:58:32","modified_gmt":"2022-03-25T04:58:32","slug":"java-concurrency-03-callable","status":"publish","type":"post","link":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/","title":{"rendered":"[Java Concurrency] 03: Callable"},"content":{"rendered":"\n<p>In the previous article, you&#8217;ve already known about the <code><a href=\"https:\/\/datmt.com\/backend\/java-concurrency-02-runnable\/\" target=\"_blank\" rel=\"noreferrer noopener\">Runnable<\/a><\/code> interface. To execute a task, you can simply create a class implement <code>Runnable<\/code> and pass an instance of that class in a thread.<\/p>\n\n\n\n<p><code>Runnable<\/code> instances don&#8217;t provide a return value, you may need a different solution if your use case requires capturing return values.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introducing Callable<\/h2>\n\n\n\n<p>Similar to Runnable, the <a href=\"https:\/\/docs.oracle.com\/en\/java\/javase\/11\/docs\/api\/java.base\/java\/util\/concurrent\/Callable.html\" target=\"_blank\" rel=\"noreferrer noopener\">Callable<\/a> interface is a functional interface. One of the key differences is you can return a value if your class implement Callable.<\/p>\n\n\n\n<p>Let&#8217;s create a class implementing Callable:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Java&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;java&quot;}\">package com.datmt.concurrency.java.simpletasks;\n\nimport java.util.concurrent.Callable;\n\npublic class D_SimpleCallableTask implements Callable&lt;String&gt; {\n    private static int instanceCount;\n    @Override\n    public String call() throws Exception {\n        try {\n\n            System.out.println(&quot;START: D_SimpleCallableTask in &quot;  + Thread.currentThread().getName() + &quot; with instance #&quot; + instanceCount);\n            Thread.sleep(1000);\n\n            System.out.println(&quot;DONE: D_SimpleCallableTask in &quot;  + Thread.currentThread().getName()  + &quot; with instance #&quot; + instanceCount);\n\n        } catch (InterruptedException ex) {\n            ex.printStackTrace();\n            return null;\n        } finally {\n            instanceCount++;\n        }\n        return  &quot;Done calling in D_SimpleCallableTask at instance count: &quot; + instanceCount;\n\n    }\n}\n<\/pre><\/div>\n\n\n\n<p>As you can see, the class <code>D_SimpleCallableTask<\/code> emulates a long running process (takes 1 second) and then returns a string.<\/p>\n\n\n\n<p>But how do we get the return result of a callable?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getting the result of callables<\/h2>\n\n\n\n<p>To execute a Callable instance, we don&#8217;t use thread. Instead, we will use an ExecutorService instance. Don&#8217;t worry if you don&#8217;t know about ExecutoreService yet. We will cover that in a later article.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Java&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;java&quot;}\">package com.datmt.concurrency.java.executor;\n\nimport com.datmt.concurrency.java.simpletasks.D_SimpleCallableTask;\n\nimport java.util.concurrent.*;\n\npublic class D_Executor {\n\n\n    public static void main(String[] args) throws InterruptedException, ExecutionException {\n\n        ExecutorService service = Executors.newSingleThreadExecutor();\n        Callable&lt;String&gt; task1 = new D_SimpleCallableTask();\n\n        Future&lt;String&gt; task1Result = service.submit(task1);\n\n        System.out.println(&quot;Task 1 result: &quot; + task1Result.get());\n\n    }\n}\n<\/pre><\/div>\n\n\n\n<p>As you can see, the <code>submit<\/code> method of <code>ExecutorService<\/code> takes a <code>Callable<\/code> instance and returns a <code>Future<\/code>.<\/p>\n\n\n\n<p>To get the result, simply call the <code>get<\/code> method on the <code>Future<\/code> instance. This method will wait, if necessary, to get the result of the call method of the <code>Callable<\/code> instance.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Throwing exceptions in Callable<\/h2>\n\n\n\n<p>Unlike  Runnable, you can throw exceptions in Callable instances and catch them later in the caller&#8217;s thread.<\/p>\n\n\n\n<p>For example, this code will <strong>NOT<\/strong> compile:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Java&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;java&quot;}\">package com.datmt.concurrency.java.simpletasks;\n\npublic class D_SimpleRunnableTask implements Runnable {\n\n    private static int instanceCount = 0;\n    @Override\n    public void run() {\n        try {\n\n            System.out.println(&quot;START: D_SimpleVoidTask in &quot;  + Thread.currentThread().getName() + &quot; with instance #&quot; + instanceCount);\n            Thread.sleep(1000);\n\n            System.out.println(&quot;DONE: D_SimpleVoidTask in &quot;  + Thread.currentThread().getName()  + &quot; with instance #&quot; + instanceCount);\n            \/\/ Throwing exception is NOT OK in Runnable\n            if (instanceCount &lt; 1)\n                throw  new Exception(&quot;Because I want to&quot;);\n            instanceCount++;\n        } catch (InterruptedException ex) {\n            ex.printStackTrace();\n        }\n    }\n}\n<\/pre><\/div>\n\n\n\n<p>But this will:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Java&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;java&quot;}\">package com.datmt.concurrency.java.simpletasks;\n\nimport java.util.concurrent.Callable;\n\npublic class D_SimpleCallableTask implements Callable&lt;String&gt; {\n    private static int instanceCount;\n    @Override\n    public String call() throws Exception {\n        try {\n\n            System.out.println(&quot;START: D_SimpleCallableTask in &quot;  + Thread.currentThread().getName() + &quot; with instance #&quot; + instanceCount);\n            Thread.sleep(1000);\n\n            System.out.println(&quot;DONE: D_SimpleCallableTask in &quot;  + Thread.currentThread().getName()  + &quot; with instance #&quot; + instanceCount);\n            \/\/ Throwing exception is OK in Callable\n            if (instanceCount &lt; 1)\n                throw  new Exception();\n        } catch (InterruptedException ex) {\n            ex.printStackTrace();\n            return null;\n        } finally {\n            instanceCount++;\n        }\n        return  &quot;Done calling in D_SimpleCallableTask at instance count: &quot; + instanceCount;\n\n    }\n}\n<\/pre><\/div>\n\n\n\n<p>In the caller&#8217;s thread, you can catch the exception like this:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Java&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;java&quot;}\">package com.datmt.concurrency.java.executor;\n\nimport com.datmt.concurrency.java.simpletasks.D_SimpleCallableTask;\n\nimport java.util.concurrent.*;\n\npublic class D_Executor {\n\n\n    public static void main(String[] args) throws InterruptedException, ExecutionException {\n\n        ExecutorService service = Executors.newSingleThreadExecutor();\n        Callable&lt;String&gt; task1 = new D_SimpleCallableTask();\n        Callable&lt;String&gt; task2 = new D_SimpleCallableTask();\n\n        try {\n            Future&lt;String&gt; task1Result = service.submit(task1);\n\n            System.out.println(&quot;Task 1 result: &quot; + task1Result.get());\n        } catch (Exception e) {\n            System.out.println(&quot;got an exception &quot; + e.getMessage());\n        }\n\n        Future&lt;String&gt; task2Result = service.submit(task2);\n\n        System.out.println(&quot;Task 2 result: &quot; + task2Result.get());\n    }\n}\n<\/pre><\/div>\n\n\n\n<p>Even when <code>task1<\/code> threw an exception, <code>task2<\/code> still running and produces the expected result:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"205\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" src=\"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png\" alt=\"Throwing execption and handling it in Callable\" class=\"wp-image-290\" srcset=\"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png 693w, https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5-300x89.png 300w\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Callable is a very powerful interface that allows to execute long-running tasks and get the result. You can also throw exceptions in Callable and catch it later in the caller&#8217;s thread.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the previous article, you&#8217;ve already known about the Runnable interface. To execute a task, you can simply create a class implement Runnable and pass an instance of that class in a thread. Runnable instances don&#8217;t provide a return value, you may need a different solution if your use case requires capturing return values. Introducing &#8230; <a title=\"[Java Concurrency] 03: Callable\" class=\"read-more\" href=\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/\" aria-label=\"Read more about [Java Concurrency] 03: Callable\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-289","post","type-post","status-publish","format-standard","hentry","category-backend"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[Java Concurrency] 03: Callable - datmt<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Java Concurrency] 03: Callable - datmt\" \/>\n<meta property=\"og:description\" content=\"In the previous article, you&#8217;ve already known about the Runnable interface. To execute a task, you can simply create a class implement Runnable and pass an instance of that class in a thread. Runnable instances don&#8217;t provide a return value, you may need a different solution if your use case requires capturing return values. Introducing ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/\" \/>\n<meta property=\"og:site_name\" content=\"datmt\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-29T04:45:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-03-25T04:58:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png\" \/>\n<meta name=\"author\" content=\"\u0110\u1ea1t Tr\u1ea7n\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u0110\u1ea1t Tr\u1ea7n\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/\"},\"author\":{\"name\":\"\u0110\u1ea1t Tr\u1ea7n\",\"@id\":\"https:\/\/datmt.com\/#\/schema\/person\/7736566e3758f424a11fd53f581c4b5e\"},\"headline\":\"[Java Concurrency] 03: Callable\",\"datePublished\":\"2021-12-29T04:45:39+00:00\",\"dateModified\":\"2022-03-25T04:58:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/\"},\"wordCount\":291,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/datmt.com\/#\/schema\/person\/7736566e3758f424a11fd53f581c4b5e\"},\"image\":{\"@id\":\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png\",\"articleSection\":[\"backend\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/\",\"url\":\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/\",\"name\":\"[Java Concurrency] 03: Callable - datmt\",\"isPartOf\":{\"@id\":\"https:\/\/datmt.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png\",\"datePublished\":\"2021-12-29T04:45:39+00:00\",\"dateModified\":\"2022-03-25T04:58:32+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#primaryimage\",\"url\":\"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png\",\"contentUrl\":\"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png\",\"width\":693,\"height\":205},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/datmt.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Java Concurrency] 03: Callable\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/datmt.com\/#website\",\"url\":\"https:\/\/datmt.com\/\",\"name\":\"datmt\",\"description\":\"Hands on projects\",\"publisher\":{\"@id\":\"https:\/\/datmt.com\/#\/schema\/person\/7736566e3758f424a11fd53f581c4b5e\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/datmt.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/datmt.com\/#\/schema\/person\/7736566e3758f424a11fd53f581c4b5e\",\"name\":\"\u0110\u1ea1t Tr\u1ea7n\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/datmt.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/datmt.com\/wp-content\/uploads\/2023\/03\/cropped-profile.jpg\",\"contentUrl\":\"https:\/\/datmt.com\/wp-content\/uploads\/2023\/03\/cropped-profile.jpg\",\"width\":512,\"height\":512,\"caption\":\"\u0110\u1ea1t Tr\u1ea7n\"},\"logo\":{\"@id\":\"https:\/\/datmt.com\/#\/schema\/person\/image\/\"},\"description\":\"I build softwares that solve problems. I also love writing\/documenting things I learn\/want to learn.\",\"sameAs\":[\"https:\/\/datmt.com\"],\"url\":\"https:\/\/datmt.com\/author\/mtdat171_c\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Java Concurrency] 03: Callable - datmt","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/","og_locale":"en_US","og_type":"article","og_title":"[Java Concurrency] 03: Callable - datmt","og_description":"In the previous article, you&#8217;ve already known about the Runnable interface. To execute a task, you can simply create a class implement Runnable and pass an instance of that class in a thread. Runnable instances don&#8217;t provide a return value, you may need a different solution if your use case requires capturing return values. Introducing ... Read more","og_url":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/","og_site_name":"datmt","article_published_time":"2021-12-29T04:45:39+00:00","article_modified_time":"2022-03-25T04:58:32+00:00","og_image":[{"url":"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png","type":"","width":"","height":""}],"author":"\u0110\u1ea1t Tr\u1ea7n","twitter_card":"summary_large_image","twitter_misc":{"Written by":"\u0110\u1ea1t Tr\u1ea7n","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#article","isPartOf":{"@id":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/"},"author":{"name":"\u0110\u1ea1t Tr\u1ea7n","@id":"https:\/\/datmt.com\/#\/schema\/person\/7736566e3758f424a11fd53f581c4b5e"},"headline":"[Java Concurrency] 03: Callable","datePublished":"2021-12-29T04:45:39+00:00","dateModified":"2022-03-25T04:58:32+00:00","mainEntityOfPage":{"@id":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/"},"wordCount":291,"commentCount":0,"publisher":{"@id":"https:\/\/datmt.com\/#\/schema\/person\/7736566e3758f424a11fd53f581c4b5e"},"image":{"@id":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#primaryimage"},"thumbnailUrl":"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png","articleSection":["backend"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/","url":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/","name":"[Java Concurrency] 03: Callable - datmt","isPartOf":{"@id":"https:\/\/datmt.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#primaryimage"},"image":{"@id":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#primaryimage"},"thumbnailUrl":"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png","datePublished":"2021-12-29T04:45:39+00:00","dateModified":"2022-03-25T04:58:32+00:00","breadcrumb":{"@id":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#primaryimage","url":"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png","contentUrl":"https:\/\/datmt.com\/wp-content\/uploads\/2021\/12\/image-5.png","width":693,"height":205},{"@type":"BreadcrumbList","@id":"https:\/\/datmt.com\/backend\/java-concurrency-03-callable\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/datmt.com\/"},{"@type":"ListItem","position":2,"name":"[Java Concurrency] 03: Callable"}]},{"@type":"WebSite","@id":"https:\/\/datmt.com\/#website","url":"https:\/\/datmt.com\/","name":"datmt","description":"Hands on projects","publisher":{"@id":"https:\/\/datmt.com\/#\/schema\/person\/7736566e3758f424a11fd53f581c4b5e"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/datmt.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/datmt.com\/#\/schema\/person\/7736566e3758f424a11fd53f581c4b5e","name":"\u0110\u1ea1t Tr\u1ea7n","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/datmt.com\/#\/schema\/person\/image\/","url":"https:\/\/datmt.com\/wp-content\/uploads\/2023\/03\/cropped-profile.jpg","contentUrl":"https:\/\/datmt.com\/wp-content\/uploads\/2023\/03\/cropped-profile.jpg","width":512,"height":512,"caption":"\u0110\u1ea1t Tr\u1ea7n"},"logo":{"@id":"https:\/\/datmt.com\/#\/schema\/person\/image\/"},"description":"I build softwares that solve problems. I also love writing\/documenting things I learn\/want to learn.","sameAs":["https:\/\/datmt.com"],"url":"https:\/\/datmt.com\/author\/mtdat171_c\/"}]}},"_links":{"self":[{"href":"https:\/\/datmt.com\/wp-json\/wp\/v2\/posts\/289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/datmt.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/datmt.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/datmt.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/datmt.com\/wp-json\/wp\/v2\/comments?post=289"}],"version-history":[{"count":1,"href":"https:\/\/datmt.com\/wp-json\/wp\/v2\/posts\/289\/revisions"}],"predecessor-version":[{"id":291,"href":"https:\/\/datmt.com\/wp-json\/wp\/v2\/posts\/289\/revisions\/291"}],"wp:attachment":[{"href":"https:\/\/datmt.com\/wp-json\/wp\/v2\/media?parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/datmt.com\/wp-json\/wp\/v2\/categories?post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/datmt.com\/wp-json\/wp\/v2\/tags?post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}