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
If it looks something like:
You are blocking (suspending) the EDT.
f.get()will block until the Future’s processing completes.