From 4d540595df864fddbc04d65af55015084a89bf82 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 3 Mar 2017 16:05:26 +0500 Subject: Schedule reconnection only if current task stopped --- src/org/traccar/smpp/SmppClient.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/smpp/SmppClient.java b/src/org/traccar/smpp/SmppClient.java index 3680d20e2..0bec60fd2 100644 --- a/src/org/traccar/smpp/SmppClient.java +++ b/src/org/traccar/smpp/SmppClient.java @@ -148,9 +148,11 @@ public class SmppClient { } public void scheduleReconnect() { - reconnectionTask = reconnectionExecutor.scheduleWithFixedDelay( - new ReconnectionTask(this), - reconnectionDelay, reconnectionDelay, TimeUnit.MILLISECONDS); + if (reconnectionTask == null || reconnectionTask.isDone()) { + reconnectionTask = reconnectionExecutor.scheduleWithFixedDelay( + new ReconnectionTask(this), + reconnectionDelay, reconnectionDelay, TimeUnit.MILLISECONDS); + } } private void stopReconnectionkTask() { -- cgit v1.2.3