From 722fd84ec1ad0d5ec4a7c8dd03505f4880c94ffe Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 7 Dec 2020 10:55:29 +0200 Subject: [PATCH] cancel running services before restart --- src/main/java/com/sparrowwallet/sparrow/AppServices.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/AppServices.java b/src/main/java/com/sparrowwallet/sparrow/AppServices.java index b7502190..50ae41c4 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppServices.java @@ -99,6 +99,10 @@ public class AppServices { }; private void restartService(ScheduledService service) { + if(service.isRunning()) { + service.cancel(); + } + if(service.getState() == Worker.State.CANCELLED) { service.reset(); }