Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6853329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:29:57+00:00 2026-05-27T01:29:57+00:00

My Java app uses a java.util.concurrent.Executors.newCachedThreadPool() to launch a number of different threads that

  • 0

My Java app uses a java.util.concurrent.Executors.newCachedThreadPool() to launch a number of different threads that do different kinds of work.

Some of the threads return a value. For these, I am using Future.get() to retrieve the value from the thread.

Other threads don’t return a value that I care about. They are declared to return an Object, and the returned value is always null. For these threads, I am currently calling Future.get() even though there is no value to get. Is that necessary, or is it pointless? My thinking was that perhaps Future.get() notifies the thread pool that I’m done with this thread.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:29:57+00:00Added an answer on May 27, 2026 at 1:29 am

    Short answer is no. However, if you want to check that everything completed successfully, Future.get() will let you know if there was an ExecutionException (by throwing it). So I usually call it, even if there is no “result” that I care about. YMMV depending on how you are doing the error handling.

    As Tom Anderson mentions, Callable<Void> is an option to remind people that there is no “result”. But frankly, my Callables meant for an Executor almost always return themselves, so that you can really double check on the results if need be. e.g. (somewhat exaggerated)

    public class LongCalculation implements Callable<LongCalculation> {
    
       public double getResult() { ... }
       public SomeEnum getStatus() { ... } // e.g. FAILED, SUCCESS, CANCELLED
       public List<String> getAnythingWeirdThatHappenned() { ... }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a simple Java app that uses JNI to call some
I'm writing my first non-trivial Java app that uses: networking a GUI threads It's
I have a java app that uses log4j. Config: log4j.rootLogger=info, file log4j.appender.file=org.apache.log4j.DailyRollingFileAppender log4j.appender.file.File=${user.home}/logs/app.log log4j.appender.file.layout=org.apache.log4j.PatternLayout
I am working on a Java app that uses Spring IoC and JDBC Template
Anyone know if it is possible to write an app that uses the Java
I have a standalone Java app that has some licensing code that I want
i have a java game app that uses sockets to communicate with each other.
I undeploy my Java EE app that uses an asynchronous logger that logs in
I have a small Java desktop app that uses Swing. There is a data
I am working on a Java web app that uses Struts 2 with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.