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

  • Home
  • SEARCH
  • 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 7519745
In Process

The Archive Base Latest Questions

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

I am trying to run a swing worker using the Executor Service and something

  • 0

I am trying to run a swing worker using the Executor Service and something strange is happening. I am currently using the method newSingleThreadExecutor(); as well as doing the following;

Future<?> f = execService.submit(swingWorker);
JOptionPane.showMessageDialog(null, "Created Future");
f.get(120, TimeUnit.SECONDS);

What happens is that my swing worker code runs perfectly so long as I don’t close the dialog message box. If I close the dialog box then my application just completely freezes. I believe the thread is getting blocked but am unsure for what reason.

If I run the swingworker on its own without the help of a execService it works perfectly, but of course the timeout feature is not available which is the whole purpose of this. Should I just use timer instead?

Thanks

  • 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-30T01:57:15+00:00Added an answer on May 30, 2026 at 1:57 am

    If it looks something like:

    public void closeDialog(){
        SwingUtitilies.invokeLater(new Runnable(){
          public void run(){
              Future<?> f = execService.submit(swingWorker);
              JOptionPane.showMessageDialog(null, "Created Future");
              f.get(120, TimeUnit.SECONDS);
          }
        });
    }
    

    You are blocking (suspending) the EDT. f.get() will block until the Future’s processing completes.

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

Sidebar

Related Questions

When trying to run an Eclipse Dynamic Web Project under a Tomcat setup using
I am using Java Swing to create a JDialog, and i am trying to
I am trying to create a java gui using netbeans but the swing panels
I've installed Jython and trying to run swing application that's bundled in installation package.
I have a problem with the code I am currently trying to run -
I'm trying to launch an external program from my java swing app using this:
I'm trying to implement Swing worker in my GUI. At the moment I have
I'm trying to create a SWING application using Java 1.6 and I have a
I am trying run a program from a qmake .pro file which modifies the
Situation: I'm trying run an https store (xcart) under one domain secure.example.com and 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.