diff options
author | Simon Rettberg | 2015-07-08 19:40:22 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-07-08 19:40:22 +0200 |
commit | f99ba9714f704ae7bc043eb4ff9ded3f8bf27026 (patch) | |
tree | 46004703ccab656860ff4eacb5b41d0ded055285 /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OrganizationList.java | |
parent | [client] Redo package structure, add comments/TODOs, rename GUI classes (diff) | |
download | tutor-module-f99ba9714f704ae7bc043eb4ff9ded3f8bf27026.tar.gz tutor-module-f99ba9714f704ae7bc043eb4ff9ded3f8bf27026.tar.xz tutor-module-f99ba9714f704ae7bc043eb4ff9ded3f8bf27026.zip |
[server] Implement OS list fetching, caching, and fallback to local DB
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 | 12 |
1 files changed, 8 insertions, 4 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 e012e5e2..35f3ebcf 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 @@ -1,11 +1,12 @@ package org.openslx.bwlp.sat.thrift.cache; +import java.sql.SQLException; import java.util.List; -import java.util.TimerTask; import org.apache.thrift.TException; import org.openslx.bwlp.sat.database.mappers.DbOrganization; import org.openslx.bwlp.sat.util.QuickTimer; +import org.openslx.bwlp.sat.util.QuickTimer.Task; import org.openslx.bwlp.thrift.iface.Organization; import org.openslx.thrifthelper.ThriftManager; @@ -25,10 +26,13 @@ public class OrganizationList extends CacheBase<List<Organization>> { protected List<Organization> getCallback() throws TException { final List<Organization> organizations = ThriftManager.getMasterClient().getOrganizations(); // Also store the list in the local data base (asynchronous, in the timer thread) - QuickTimer.scheduleOnce(new TimerTask() { + QuickTimer.scheduleOnce(new Task() { @Override - public void run() { - DbOrganization.storeOrganizations(organizations); + public void fire() { + try { + DbOrganization.storeOrganizations(organizations); + } catch (SQLException e) { + } } }); return organizations; |