+ public synchronized Map<String, Long> loadSoneFollowingTimes() {
+ Map<String, Long> soneFollowingTimes = new HashMap<String, Long>();
+ int counter = 0;
+ while (true) {
+ String soneId = configuration.getStringValue("SoneFollowingTimes/" + counter + "/Sone").getValue(null);
+ if (soneId == null) {
+ break;
+ }
+ long followingTime = configuration.getLongValue("SoneFollowingTimes/" + counter + "/Time").getValue(Long.MAX_VALUE);
+ soneFollowingTimes.put(soneId, followingTime);
+ counter++;
+ }
+ return soneFollowingTimes;
+ }
+
+ public synchronized void saveSoneFollowingTimes(Map<String, Long> soneFollowingTimes) {
+ try {
+ int counter = 0;
+ for (Entry<String, Long> soneFollowingTime : soneFollowingTimes.entrySet()) {
+ configuration.getStringValue("SoneFollowingTimes/" + counter + "/Sone")
+ .setValue(soneFollowingTime.getKey());
+ configuration.getLongValue("SoneFollowingTimes/" + counter + "/Time")
+ .setValue(soneFollowingTime.getValue());
+ counter++;
+ }
+ configuration.getStringValue("SoneFollowingTimes/" + counter + "/Sone").setValue(null);
+ } catch (ConfigurationException ce1) {
+ logger.log(WARNING, "Could not save Sone following times!", ce1);
+ }
+ }
+