minor code cleanup
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jannik 2019-10-27 14:09:06 +01:00
parent 5e71bb95f0
commit e4cc195fa8
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
2 changed files with 12 additions and 14 deletions

View File

@ -358,28 +358,26 @@ public class MainWindowController {
* check if all posters are cached, if not cache the missing ones
*/
void checkAllPosters() {
dbController.refreshDataBase(); // refreshes the database after a source path was added
// get all not cached entries, none of them should have a cached poster
ExecutorService executor = Executors.newFixedThreadPool(5);
for (FilmTabelDataType entry : dbController.getAllNotCachedEntries()) {
// System.out.println(entry.getStreamUrl() + " is NOT cached!");
dbController.refreshDataBase(); // refreshes the database after a source path was added
// get all not cached entries
for (FilmTabelDataType entry : dbController.getAllNotCachedEntries()) {
Runnable OMDbAPIWorker = new OMDbAPIController(entry);
executor.execute(OMDbAPIWorker);
}
executor.shutdown();
// TODO show loading screen
// we might need this as otherwise it would load before all tasks are finished
// wait for all OMDbAPI requests to finish
try {
executor.awaitTermination(1, TimeUnit.MINUTES);
} catch (InterruptedException e) {
LOGGER.error(e);
}
System.out.println("finished refresh");
}

View File

@ -420,7 +420,7 @@ public class DBController {
connection.commit();
ps.close();
} catch (SQLException e) {
LOGGER.error("Ups! an error occured!", e);
LOGGER.error("Ups! An error occured!", e);
}
}
@ -437,7 +437,7 @@ public class DBController {
connection.commit();
ps.close();
} catch (SQLException e) {
LOGGER.error("Ups! an error occured!", e);
LOGGER.error("Ups! An error occured, while setting cached = DATE for {}.", streamUrl, e);
}
}
@ -459,7 +459,7 @@ public class DBController {
rs.close();
ps.close();
} catch (SQLException e) {
LOGGER.error("Ups! an error occured!", e);
LOGGER.error("Ups! An error occured, while rerading the cached date for {}.", streamUrl, e);
}
return cacheDate;
@ -507,7 +507,7 @@ public class DBController {
connection.commit();
ps.close();
} catch (Exception e) {
LOGGER.error(e);
LOGGER.error("Ups! An error while adding cache data for {}.", streamUrl, e);
}
}
@ -526,7 +526,7 @@ public class DBController {
rs.close();
ps.close();
} catch (Exception e) {
LOGGER.error("Ups! error while getting the current time!", e);
LOGGER.error("Ups! An error while searching for {} in the cache.", streamUrl, e);
}
return retValue;
@ -572,7 +572,7 @@ public class DBController {
rs.close();
ps.close();
} catch (SQLException e) {
LOGGER.error("Ups! an error occured!", e);
LOGGER.error("Ups! error while getting the current time for {}.", streamUrl, e);
}
return cacheData;