Reload only specific entities (work in progress)

- Remove attempt of reinitializing all components -> will lead to inconsistent states. Call reload on reloadable components instead
This commit is contained in:
ljacqu
2016-03-09 18:39:04 +01:00
parent 4d55bedcaa
commit dfc713fde6
7 changed files with 33 additions and 85 deletions
@@ -64,6 +64,11 @@ public class CacheDataSource implements DataSource {
return cachedAuths;
}
@Override
public void reload() {
source.reload();
}
@Override
public synchronized boolean isAuthAvailable(String user) {
return getAuth(user) != null;
@@ -187,4 +187,9 @@ public interface DataSource {
boolean isEmailStored(String email);
/**
* Reload the data source.
*/
void reload();
}
@@ -59,6 +59,11 @@ public class FlatFile implements DataSource {
this.source = source;
}
@Override
public void reload() {
throw new UnsupportedOperationException("Flatfile no longer supported");
}
@Override
public synchronized boolean isAuthAvailable(String user) {
BufferedReader br = null;
@@ -131,7 +131,8 @@ public class MySQL implements DataSource {
ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!");
}
private synchronized void reloadArguments() throws RuntimeException {
@Override
public synchronized void reload() throws RuntimeException {
if (ds != null) {
ds.close();
}
@@ -124,6 +124,11 @@ public class SQLite implements DataSource {
ConsoleLogger.info("SQLite Setup finished");
}
@Override
public void reload() {
// TODO 20160309: Implement reloading
}
@Override
public synchronized boolean isAuthAvailable(String user) {
PreparedStatement pst = null;