test reconnect logic
This commit is contained in:
parent
a98c3eae71
commit
f0e654399a
@ -94,8 +94,25 @@ public class JDBC {
|
|||||||
password);
|
password);
|
||||||
loggedin = true;
|
loggedin = true;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
//logintodb(usernamec, passwordc, dbnamec, ipc, portc);
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
Thread.sleep(10 * 1000);
|
||||||
|
} catch (InterruptedException interruptedException) {
|
||||||
|
interruptedException.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
logintodb(usernamec, passwordc, dbnamec, ipc, portc);
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
ioException.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
throw new IOException("No connection to database");
|
throw new IOException("No connection to database");
|
||||||
// todo reconnect every 5mins or something
|
// todo reconnect every 5mins or something
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user