Need to shutdown the ExecutorService or the application will stay open

This commit is contained in:
Sam Harwell 2012-12-29 00:16:59 -06:00
parent 7811ad9e49
commit 5d390b4a90
1 changed files with 9 additions and 2 deletions

View File

@ -74,6 +74,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
@ -360,8 +361,14 @@ public class TreeViewer extends JComponent {
}
};
Future<JDialog> result = Executors.newSingleThreadExecutor().submit(callable);
return result;
ExecutorService executor = Executors.newSingleThreadExecutor();
try {
return executor.submit(callable);
}
finally {
executor.shutdown();
}
}
public void save(String fileName) throws IOException, PrintException {