tag:blogger.com,1999:blog-694855878384792308.post3241124847762101076..comments2024-03-21T06:26:49.387-07:00Comments on Java67: Difference between Callable and Runnable in Java? call() vs run() methodjavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-694855878384792308.post-63786538985321713812016-08-30T14:29:24.571-07:002016-08-30T14:29:24.571-07:00Sir Mr Laurent Thomas i am new to this callable in...Sir Mr Laurent Thomas i am new to this callable interface if you could share your experience with these interface then it would be better for usAnonymoushttps://www.blogger.com/profile/07601097295905585300noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-47957981655184124842014-12-17T09:05:17.698-08:002014-12-17T09:05:17.698-08:00Well the fact that method call() can return whatev...Well the fact that method call() can return whatever type you want makes easy to trigger the execution of a method into a separate thread and return when the execution is over.<br />For example, I have been using this pattern lately to run Groovy scripts into a Java application to handle specific behaviours for some of our customers. With running the custom script (written by third parties) into separate threads, I can better control their execution (i.e. stop them if they exceed a maximum duration). Combined with the java ScriptEngine framework, all I had to do is provide with an interface that Groovy scripts had to implement, and a little code to stick all this together.<br /><br />But honestly, the above article is a little poor as it doesn't provide much more information that the API javadoc.<br />Laurent Thomashttps://www.blogger.com/profile/12079631650439005135noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-64215789810656275112014-12-16T23:40:43.616-08:002014-12-16T23:40:43.616-08:00What is the real use of Callable interface, I have...What is the real use of Callable interface, I have never use it in production yet. to me Runnable seems to work always? I know that Callable can return value, throw Exception but I have to yet to found a convincing case to use it on production code. Can anyone who has some hands on experience suggest good examples of Callable in Java?Channoreply@blogger.com