From 290d26dc0fb5f1dcffa341c1aba4647fbc55aabe Mon Sep 17 00:00:00 2001 From: Bojan Momcilov Date: Thu, 23 Sep 2021 10:30:07 +0200 Subject: [PATCH] StartStop inherits QBeanAsyncSupport --- .../main/java/org/jpos/ee/info/StartStop.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/syslog/src/main/java/org/jpos/ee/info/StartStop.java b/modules/syslog/src/main/java/org/jpos/ee/info/StartStop.java index db30e63024..70a911c8b4 100644 --- a/modules/syslog/src/main/java/org/jpos/ee/info/StartStop.java +++ b/modules/syslog/src/main/java/org/jpos/ee/info/StartStop.java @@ -20,25 +20,26 @@ import org.jpos.ee.SysLog; import org.jpos.ee.SysLogManager; -import org.jpos.q2.QBeanSupport; +import org.jpos.q2.QBeanAsyncSupport; import org.jpos.util.DateUtil; @SuppressWarnings("unused") -public class StartStop extends QBeanSupport implements Runnable { +public class StartStop extends QBeanAsyncSupport { long start; - public void startService() { + + @Override + protected void doStart() { start = System.currentTimeMillis(); - new Thread(this, getName()).start(); - } - public void run () { if (getServer().ready(60000L)) { new SysLogManager().log (cfg.get ("source", getName()), - "SYSTEM", SysLog.INFO, "Start"); + "SYSTEM", SysLog.INFO, "Start"); } else { getLog().warn ("Q2 not ready"); } } - public void stopService() { + + @Override + protected void doStop() { long elapsed = System.currentTimeMillis() - start; new SysLogManager().log (cfg.get ("source", getName()), "SYSTEM", SysLog.INFO, "Stop (uptime " + DateUtil.toDays(elapsed) + ")"