summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2016-01-21 21:03:58 +0100
committerSimon Rettberg2016-01-21 21:03:58 +0100
commit71124810050847b041c8b245236e25ccaacb1e6f (patch)
treea05be2fecc3da5bd319ea947ebc19e812cb0b170
parent[client] Remove useless comments (diff)
downloadtutor-module-71124810050847b041c8b245236e25ccaacb1e6f.tar.gz
tutor-module-71124810050847b041c8b245236e25ccaacb1e6f.tar.xz
tutor-module-71124810050847b041c8b245236e25ccaacb1e6f.zip
[client] Remember if sat supports locations and stop querying if not
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java
index 068e077b..f44523dc 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java
@@ -3,6 +3,7 @@ package org.openslx.dozmod.thrift.cache;
import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.thrift.TApplicationException;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.Location;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
@@ -46,12 +47,23 @@ public class MetaDataCache {
}
};
+ private static int locationFails = 0;
+
private static final GenericDataCache<List<Location>> locationCache = new GenericDataCache<List<Location>>(
CACHE_TIME_MS) {
@Override
protected List<Location> update() throws TException {
+ if (locationFails > 2)
+ return null;
try {
- return ThriftManager.getSatClient().getLocations();
+ List<Location> ret = ThriftManager.getSatClient().getLocations();
+ locationFails = 0;
+ return ret;
+ } catch (TApplicationException e) {
+ locationFails++;
+ if (locationFails == 1) {
+ LOGGER.info("Satellite doesn't seem to support locations");
+ }
} catch (TException e) {
LOGGER.warn("Could not get locations list from the satellite...", e);
}