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 8712405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:06:11+00:00 2026-06-13T05:06:11+00:00

I am trying to submit a task to an ExecutorService in Java. It either

  • 0

I am trying to submit a task to an ExecutorService in Java. It either takes a Callable, which allows to throw an Exception, or it takes a Runnable. My use case is as foolows: I would like to schedule a task which throws an Exception, but is a void method. As a result I cannot use either Callable or Runnable, as the method definitions do not match my use case. I would also like to have my excepton propagated from the Future I receive after submission. Any ideas?

  • 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-06-13T05:06:12+00:00Added an answer on June 13, 2026 at 5:06 am

    You can use Callable<Void>. Obviously you can’t instantiate a Void object, but just return null.

    From the Future<Void>, you can still call get, discarding the null return value. It will rethrow any exception as an ExecutionException.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use ExecutorService.newFixedThreadPool to running several tasks. Every time I submit to
I'm trying to submit a bug to a bugzilla server with mylyn task plugin
I'm trying to use Java's ThreadPoolExecutor class to run a large number of heavy
I am trying to debug a device driver which apparently causes other task to
Im trying to submit a specific form programatically, but I allways get the initial
I'm trying to submit a form (it's a dynamic form with fields added via
i am trying to submit 2 forms at the same time im trying to
I am trying to submit two forms at once (one goes to db and
I'm trying to submit a form entry with an uploaded file, but I can't
I'm trying to submit a form when a select changes using jQuery Mobile. I

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.