From 78728dfb6d1adaaa261d689b2f104bc2e445ce6a Mon Sep 17 00:00:00 2001 From: Federico Date: Tue, 26 Jan 2021 19:14:49 -0300 Subject: [PATCH 1/2] Use the 'Environment' class to get the monitor properties. --- .../status/src/main/java/org/jpos/ee/status/Monitor.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/status/src/main/java/org/jpos/ee/status/Monitor.java b/modules/status/src/main/java/org/jpos/ee/status/Monitor.java index e69414044e..f5337cbb53 100644 --- a/modules/status/src/main/java/org/jpos/ee/status/Monitor.java +++ b/modules/status/src/main/java/org/jpos/ee/status/Monitor.java @@ -28,6 +28,7 @@ import org.jpos.q2.QBeanSupport; import org.jpos.core.XmlConfigurable; import org.jpos.core.ConfigurationException; +import org.jpos.core.Environment; import org.jdom2.Element; import org.hibernate.HibernateException; @@ -71,6 +72,7 @@ public void setConfiguration (Element config) { private void registerTask (Element e) throws ConfigurationException { + Environment env = Environment.getEnvironment(); QFactory qf = getServer().getFactory(); Object obj = qf.newInstance (e.getChildTextTrim ("class")); if (!(obj instanceof MonitorTask)) { @@ -82,10 +84,10 @@ private void registerTask (Element e) qf.setConfiguration (obj, e); timer.schedule ( new MonitorTimerTask ( - e.getAttributeValue("id"), + env.getProperty(e.getAttributeValue("id")), (MonitorTask) obj), - getLong (e.getAttributeValue ("delay")), - getLong (e.getAttributeValue ("period")) + getLong (env.getProperty(e.getAttributeValue ("delay"))), + getLong (env.getProperty(e.getAttributeValue ("period"))) ); } private long getLong (String l) From 53d43fa32becbc2fe860c0f0629784abb2957964 Mon Sep 17 00:00:00 2001 From: Federico Date: Tue, 26 Jan 2021 19:42:09 -0300 Subject: [PATCH 2/2] Use the Environment::get() shortcut. --- .../status/src/main/java/org/jpos/ee/status/Monitor.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/status/src/main/java/org/jpos/ee/status/Monitor.java b/modules/status/src/main/java/org/jpos/ee/status/Monitor.java index f5337cbb53..8c8ace763f 100644 --- a/modules/status/src/main/java/org/jpos/ee/status/Monitor.java +++ b/modules/status/src/main/java/org/jpos/ee/status/Monitor.java @@ -72,7 +72,6 @@ public void setConfiguration (Element config) { private void registerTask (Element e) throws ConfigurationException { - Environment env = Environment.getEnvironment(); QFactory qf = getServer().getFactory(); Object obj = qf.newInstance (e.getChildTextTrim ("class")); if (!(obj instanceof MonitorTask)) { @@ -84,10 +83,10 @@ private void registerTask (Element e) qf.setConfiguration (obj, e); timer.schedule ( new MonitorTimerTask ( - env.getProperty(e.getAttributeValue("id")), + Environment.get(e.getAttributeValue("id")), (MonitorTask) obj), - getLong (env.getProperty(e.getAttributeValue ("delay"))), - getLong (env.getProperty(e.getAttributeValue ("period"))) + getLong (Environment.get(e.getAttributeValue ("delay"))), + getLong (Environment.get(e.getAttributeValue ("period"))) ); } private long getLong (String l)