Skip to content

Commit

Permalink
executor service
Browse files Browse the repository at this point in the history
  • Loading branch information
Evegen55 committed Dec 11, 2017
1 parent 466b3c6 commit 741c29a
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/main/java/ramo/klevis/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
* Created by klevis.ramo on 11/24/2017.
Expand All @@ -18,6 +20,8 @@ public class Run {

private final static Logger LOGGER = LoggerFactory.getLogger(Run.class);

public static final ExecutorService EXECUTOR_SERVICE = Executors.newCachedThreadPool();

private static JFrame mainFrame = new JFrame();

public static void main(String[] args) throws Exception {
Expand All @@ -27,17 +31,8 @@ public static void main(String[] args) throws Exception {
setHadoopHomeEnvironmentVariable();
ProgressBar progressBar = new ProgressBar(mainFrame, true);
progressBar.showProgressBar("Collecting data this make take several seconds!");
new Thread(() -> {
try {
new UI().initUI();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
progressBar.setVisible(false);
mainFrame.dispose();
}
}).start();

UI ui = new UI();
EXECUTOR_SERVICE.submit(ui::initUI);
}


Expand Down

0 comments on commit 741c29a

Please sign in to comment.