I was told to run all of my MySQL connection processes on another thread besides the main thread to avoid the main thread from being stuck on a process that takes a few seconds to process.
Therefore, I established a ConnectionPool in a separate thread, so that my GUI launches independently from the establishment of the connection. However, this is not the case. When I run the program, it waits until the connection is established and then it actually runs launch(args); My concern is why is it not running independently when a new thread is being established?
public static void main(String[] args) {
initiateConnection();
launch(args);
}
private static void initiateConnection() {
new Thread(() -> {
try {
connection = new ConnectionPool("jdbc:mysql://127.0.0.0/comm", "root",
"pass");
} catch (Exception e) {
}
}).run();
}