Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2017-07-31 21:28:34 +0000
committerdonald.g.dunne2017-08-01 17:43:20 +0000
commit08b33322b92ba5e1bbee47b84e61320c98e4a88f (patch)
tree4280a14b5f2552a20dd8cf68b419ac3ea90544b2
parent22c1b8071eef2ebcc15a9c228898a0a101c47e70 (diff)
downloadorg.eclipse.osee-08b33322b92ba5e1bbee47b84e61320c98e4a88f.tar.gz
org.eclipse.osee-08b33322b92ba5e1bbee47b84e61320c98e4a88f.tar.xz
org.eclipse.osee-08b33322b92ba5e1bbee47b84e61320c98e4a88f.zip
refinement: Add timer to ATS Server to reload caches0.25.0.v201708012108-NRB
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
index 6a7b6886b46..d7ecb28fb7d 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
@@ -62,6 +62,7 @@ import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.type.ViewModel;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.jaxrs.OseeWebApplicationException;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsApi;
@@ -80,6 +81,7 @@ public final class AtsConfigEndpointImpl implements AtsConfigEndpointApi {
private AtsConfigurations atsConfigurations;
private final Collection<Long> teamDefIds = new LinkedList<>();
private final Collection<Long> aiIds = new LinkedList<>();
+ private final long DEFAULT_CONFIG_LOADING_TIME = 1200000; // 20 minutes
public AtsConfigEndpointImpl(IAtsServices services, OrcsApi orcsApi, Log logger) {
this.services = services;
@@ -92,8 +94,20 @@ public final class AtsConfigEndpointImpl implements AtsConfigEndpointApi {
Thread thread = new Thread("ATS Configuration Re-Loader") {
@Override
public void run() {
- AtsConfigurations configs = getAtsConfigurationsFromDb();
- atsConfigurations = configs;
+ while (true) {
+ AtsConfigurations configs = getAtsConfigurationsFromDb();
+ atsConfigurations = configs;
+ try {
+ long reloadTime = DEFAULT_CONFIG_LOADING_TIME;
+ String reloadTimeStr = services.getConfigValue("server_config_reload_ms");
+ if (Strings.isNumeric(reloadTimeStr)) {
+ reloadTime = Long.valueOf(reloadTimeStr);
+ }
+ Thread.sleep(reloadTime);
+ } catch (InterruptedException ex) {
+ // do nothing
+ }
+ }
}
};
thread.start();

Back to the top