summaryrefslogtreecommitdiff
path: root/bkucommon/src/main
diff options
context:
space:
mode:
authortkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2013-12-10 16:16:22 +0000
committertkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2013-12-10 16:16:22 +0000
commit0d947bc3b357e3a875bbe740ed007f54d83a9389 (patch)
tree4a31e7a010c843b64b978f846a11fdc279b601af /bkucommon/src/main
parente60190e2c28b66e98864d6b0c5973e2ee2e553aa (diff)
downloadmocca-0d947bc3b357e3a875bbe740ed007f54d83a9389.tar.gz
mocca-0d947bc3b357e3a875bbe740ed007f54d83a9389.tar.bz2
mocca-0d947bc3b357e3a875bbe740ed007f54d83a9389.zip
Increase BindingProcessor timeout to 5 min, make configurable
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1245 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'bkucommon/src/main')
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java34
1 files changed, 25 insertions, 9 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java
index 44f95602..ef911e0b 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java
@@ -43,6 +43,7 @@ import org.apache.commons.configuration.Configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.gv.egiz.bku.conf.MoccaConfigurationFacade;
import at.gv.egiz.bku.jmx.ComponentMXBean;
import at.gv.egiz.bku.jmx.ComponentState;
import at.gv.egiz.bku.slcommands.SLCommandInvoker;
@@ -56,16 +57,14 @@ import at.gv.egiz.stal.STALFactory;
*/
public class BindingProcessorManagerImpl implements BindingProcessorManager, ComponentMXBean {
- public static long DEFAULT_MAX_ACCEPTED_AGE = 2 * 60 * 1000;
+ public static long DEFAULT_MAX_ACCEPTED_AGE = 5 * 60 * 1000; // 5 Minutes
public static int DEFAULT_CLEAN_UP_INTERVAL = 60;
- private final Logger log = LoggerFactory.getLogger(BindingProcessorManagerImpl.class);
+ private final static Logger log = LoggerFactory.getLogger(BindingProcessorManagerImpl.class);
private List<BindingProcessorFactory> factories = Collections.emptyList();
- private Configuration configuration;
-
private STALFactory stalFactory;
private SLCommandInvoker commandInvoker;
@@ -77,7 +76,21 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager, Com
private int cleanUpInterval = DEFAULT_CLEAN_UP_INTERVAL;
- private long maxAcceptedAge = DEFAULT_MAX_ACCEPTED_AGE;
+ private long maxAcceptedAge = -1;
+
+ public final ConfigurationFacade configurationFacade = new ConfigurationFacade();
+
+ public class ConfigurationFacade implements MoccaConfigurationFacade {
+
+ private Configuration configuration;
+
+ public static final String BINDING_PROCESSOR_TIMEOUT = "BindingProcessorTimeout";
+
+ public long getBindingProcessorTimeout() {
+ return configuration.getLong(BINDING_PROCESSOR_TIMEOUT, DEFAULT_MAX_ACCEPTED_AGE);
+ }
+
+ }
private ScheduledExecutorService cleanUpService = Executors
.newSingleThreadScheduledExecutor();
@@ -91,14 +104,14 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager, Com
* @return the configuration
*/
public Configuration getConfiguration() {
- return configuration;
+ return configurationFacade.configuration;
}
/**
* @param configuration the configuration to set
*/
public void setConfiguration(Configuration configuration) {
- this.configuration = configuration;
+ configurationFacade.configuration = configuration;
}
/**
@@ -158,7 +171,8 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager, Com
* @return the current maximum inactive time of a BindingProcessor
*/
public long getMaxAcceptedAge() {
- return maxAcceptedAge;
+ return maxAcceptedAge < 0 ?
+ configurationFacade.getBindingProcessorTimeout() : maxAcceptedAge;
}
/**
@@ -322,7 +336,9 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager, Com
}
if ((System.currentTimeMillis() - bindingProcessor
.getLastAccessTime().getTime()) > getMaxAcceptedAge()) {
- toBeRemoved.add(bindingProcessor.getId());
+ Id id = bindingProcessor.getId();
+ toBeRemoved.add(id);
+ log.debug("Removing BindingProcessor {} for exceeding {}ms", id, getMaxAcceptedAge());
}
}
for (Id id : toBeRemoved) {