Skip to content

Commit

Permalink
Merge pull request #228 from bmomcilov/feature/StartStop-inherits-QBe…
Browse files Browse the repository at this point in the history
…anAsyncSupport

StartStop inherits QBeanAsyncSupport
  • Loading branch information
ar authored Oct 1, 2021
2 parents c0fbf7f + 290d26d commit e46f8bd
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions modules/syslog/src/main/java/org/jpos/ee/info/StartStop.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) + ")"
Expand Down

0 comments on commit e46f8bd

Please sign in to comment.