From 1cc3a5cf839bea72093e0d604f8b041dc74bae85 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 25 Aug 2015 18:45:10 +0200 Subject: [server] Reduce spam when fetching OS and Virt list from master --- .../bwlp/sat/thrift/cache/OperatingSystemList.java | 4 ++- .../bwlp/sat/thrift/cache/VirtualizerList.java | 31 ++++++++++++---------- 2 files changed, 20 insertions(+), 15 deletions(-) (limited to 'dozentenmodulserver/src/main/java/org') diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OperatingSystemList.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OperatingSystemList.java index 903db0c5..2f6bbdbc 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OperatingSystemList.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OperatingSystemList.java @@ -5,6 +5,7 @@ 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.DbOsVirt; import org.openslx.bwlp.thrift.iface.OperatingSystem; import org.openslx.thrifthelper.ThriftManager; @@ -31,7 +32,8 @@ public class OperatingSystemList extends CacheBase> { try { list = ThriftManager.getMasterClient().getOperatingSystems(); } catch (TException e1) { - LOGGER.warn("Could not fetch OS list from master, using local data...", e1); + LOGGER.warn("Could not fetch OS list from master, using local data...", + e1 instanceof TTransportException ? null : e1); try { return DbOsVirt.getOsList(); } catch (SQLException e) { diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/VirtualizerList.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/VirtualizerList.java index 469096d8..28463e6b 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/VirtualizerList.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/VirtualizerList.java @@ -1,14 +1,16 @@ package org.openslx.bwlp.sat.thrift.cache; +import java.sql.SQLException; import java.util.List; -import org.apache.log4j.Logger; - -import org.openslx.bwlp.sat.database.mappers.DbOsVirt; -import java.sql.SQLException; +import org.apache.log4j.Logger; import org.apache.thrift.TException; +import org.apache.thrift.transport.TTransportException; +import org.openslx.bwlp.sat.database.mappers.DbOsVirt; import org.openslx.bwlp.thrift.iface.Virtualizer; import org.openslx.thrifthelper.ThriftManager; +import org.openslx.util.QuickTimer; +import org.openslx.util.QuickTimer.Task; /** * Holds the list of all known virtualizers. The list is synchronized with @@ -30,7 +32,8 @@ public class VirtualizerList extends CacheBase> { try { list = ThriftManager.getMasterClient().getVirtualizers(); } catch (TException e1) { - LOGGER.warn("Could not fetch Virtualizer list from master, using local data...", e1); + LOGGER.warn("Could not fetch Virtualizer list from master, using local data...", + e1 instanceof TTransportException ? null : e1); try { return DbOsVirt.getVirtualizerList(); } catch (SQLException e) { @@ -38,15 +41,15 @@ public class VirtualizerList extends CacheBase> { } return null; } -// QuickTimer.scheduleOnce(new Task() { -// @Override -// public void fire() { -// try { -// DbOsVirt.storeOsList(list); -// } catch (SQLException e) { -// } -// } -// }); + QuickTimer.scheduleOnce(new Task() { + @Override + public void fire() { + try { + DbOsVirt.storeVirtualizerList(list); + } catch (SQLException e) { + } + } + }); return list; } -- cgit v1.2.3-55-g7522