diff options
author | Simon Rettberg | 2015-09-09 15:14:43 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-09-09 15:14:43 +0200 |
commit | 864297f4ae1530da3a4d7a903782b6e34071b424 (patch) | |
tree | 1296c12fe2f9a0dc8e2b3cfefaa65870df9c5fd4 /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OrganizationList.java | |
parent | [server] Also inform lecture owners about expising images, if the image expir... (diff) | |
download | tutor-module-864297f4ae1530da3a4d7a903782b6e34071b424.tar.gz tutor-module-864297f4ae1530da3a4d7a903782b6e34071b424.tar.xz tutor-module-864297f4ae1530da3a4d7a903782b6e34071b424.zip |
[server] Fix virtualizer store query
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OrganizationList.java')
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OrganizationList.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OrganizationList.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OrganizationList.java index 4325b152..6d2ebda2 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OrganizationList.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OrganizationList.java @@ -3,7 +3,9 @@ package org.openslx.bwlp.sat.thrift.cache; import java.sql.SQLException; import java.util.List; +import org.apache.log4j.Logger; import org.apache.thrift.TException; +import org.apache.thrift.transport.TTransportException; import org.openslx.bwlp.sat.database.mappers.DbOrganization; import org.openslx.bwlp.thrift.iface.Organization; import org.openslx.thrifthelper.ThriftManager; @@ -15,6 +17,8 @@ import org.openslx.util.QuickTimer.Task; * the master server. */ public class OrganizationList extends CacheBase<List<Organization>> { + + private static final Logger LOGGER = Logger.getLogger(OrganizationList.class); private static final OrganizationList instance = new OrganizationList(); @@ -24,7 +28,19 @@ public class OrganizationList extends CacheBase<List<Organization>> { @Override protected List<Organization> getCallback() throws TException { - final List<Organization> organizations = ThriftManager.getMasterClient().getOrganizations(); + final List<Organization> organizations; + try { + organizations = ThriftManager.getMasterClient().getOrganizations(); + } catch (TException e1) { + LOGGER.warn("Could not fetch Organization list from master, using local data...", + e1 instanceof TTransportException ? null : e1); + try { + return DbOrganization.getAll(); + } catch (SQLException e) { + LOGGER.warn("Using local Organization list from database also failed.", e); + } + return null; + } // Also store the list in the local data base (asynchronous, in the timer thread) QuickTimer.scheduleOnce(new Task() { @Override |