tag:blogger.com,1999:blog-8712770457197348465.post2230960795377121559..comments2024-03-17T23:01:26.872-07:00Comments on Javarevisited: How to use Future and FutureTask in Java Concurrency with Examplejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-8712770457197348465.post-66420453625007668192020-06-18T21:17:57.540-07:002020-06-18T21:17:57.540-07:00future.get() is blocking call as suggested by Pros...future.get() is blocking call as suggested by Prosenjit, if you want your application to not do anything till then you can call get() but done() is for asynchronous checking. javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-4043247569812266842020-06-18T21:10:52.845-07:002020-06-18T21:10:52.845-07:00future.get() will wait till the executionfuture.get() will wait till the executionProsenjit Dashttps://www.blogger.com/profile/00448613710041083489noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-83434784397113666802019-01-06T21:16:20.867-08:002019-01-06T21:16:20.867-08:00I don't think we need a future.done check in t...I don't think we need a future.done check in this code. future.get() will wait till the execution is complete and display the result.Guruprasadhttps://www.blogger.com/profile/15636679156319025424noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-35217916280634747652017-01-27T01:12:05.272-08:002017-01-27T01:12:05.272-08:00That is the confusing part. Factorial of 10 is 362...That is the confusing part. Factorial of 10 is 3628800 and not of 1000000 <br />Javin please correct the same Vivek Hingoranihttps://www.blogger.com/profile/01065655402414692963noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-4457588950820943182016-12-13T09:30:01.463-08:002016-12-13T09:30:01.463-08:00Best part is that the factorial of 1000000 is 3628...Best part is that the factorial of 1000000 is 3628800.Safwan Ahmad Siddiqihttps://www.blogger.com/profile/08010704145265710986noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-66596286899388958752016-04-25T23:54:08.233-07:002016-04-25T23:54:08.233-07:00How to submit three tasks to threadpool? Creating ...How to submit three tasks to threadpool? Creating three instances of FactorialCalculator and then <br />Future future1 = threadpool.submit(task1); <br />Future future2 = threadpool.submit(task2); <br />Future future3 = threadpool.submit(task3); Anonymoushttps://www.blogger.com/profile/17704125950914555905noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-21386660174221985652016-03-11T23:13:53.761-08:002016-03-11T23:13:53.761-08:00thanks for your article.It helps me.thanks for your article.It helps me.Anonymoushttps://www.blogger.com/profile/17151374541392623600noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-16666087468539476272016-01-18T04:08:45.157-08:002016-01-18T04:08:45.157-08:00In this program, because there is only one call to...In this program, because there is only one call to calculate factorial, thread pool is not really tested. If you want to test thread pool, calculate factorial from multiple threads. Since we are using a fixed thread pool of size 3, you will notice your thread waiting longer as you calculate large factorials.javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-11660660578680346112016-01-18T01:37:33.499-08:002016-01-18T01:37:33.499-08:00What is purpose of Thread pool here. I can have n ...What is purpose of Thread pool here. I can have n number of threads from pool and program output does not vary at all.Anonymoushttps://www.blogger.com/profile/13881306914394005459noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-31060805208662594912015-06-18T18:38:17.020-07:002015-06-18T18:38:17.020-07:00One of the drawback of using Future is that you ei...One of the drawback of using Future is that you either need to periodically check whether task is completed or not e.g. by using isDone() method or wait until task is completed by calling blocking get() method. There is no way to receive the notification when task is completed. This shortcoming is addressed in CompletableFture, which allows you to schedule some execution when the task is done. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-5085085696877570772015-01-27T23:36:17.970-08:002015-01-27T23:36:17.970-08:00Hi Javin,
pls check my blog on this , pls lem me ...Hi Javin,<br /><br />pls check my blog on this , pls lem me know your feedback on this..<br /><br />http://saralsaxena.blogspot.in/2015/01/parallel-processing_4.htmlSARAL SAXENAhttps://www.blogger.com/profile/01084233786047386880noreply@blogger.com