use cache only if not waiting for latest analyses

This commit is contained in:
Axel Uhl committed 2012-07-19 16:45:44 +02:00
1 parent bafab3a7a0
commit 7bc53ef5d1
1 file changed
+4 -2
@@ -373,10 +373,12 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
throws NoWindException, InterruptedException, ExecutionException { throws NoWindException, InterruptedException, ExecutionException {
Triple<String, Date, Collection<String>> key = new Triple<String, Date, Collection<String>>( Triple<String, Date, Collection<String>> key = new Triple<String, Date, Collection<String>>(
leaderboardName, date, namesOfRaceColumnsForWhichToLoadLegDetails); leaderboardName, date, namesOfRaceColumnsForWhichToLoadLegDetails);
FutureTask<LeaderboardDTO> future; FutureTask<LeaderboardDTO> future = null;
boolean cacheHit = false; boolean cacheHit = false;
synchronized (leaderboardByNameCache) { synchronized (leaderboardByNameCache) {
future = leaderboardByNameCache.get(key); if (!waitForLatestAnalyses) {
future = leaderboardByNameCache.get(key);
}
if (future == null) { if (future == null) {
future = new FutureTask<LeaderboardDTO>(new Callable<LeaderboardDTO>() { future = new FutureTask<LeaderboardDTO>(new Callable<LeaderboardDTO>() {
@Override @Override