diff options
author | Abyss777 <abyss@fox5.ru> | 2017-03-03 16:05:26 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-03-03 16:05:26 +0500 |
commit | 4d540595df864fddbc04d65af55015084a89bf82 (patch) | |
tree | e4c8d3863687d2296d90be4d0b43ab1330cf0812 | |
parent | 4aa952d70b186d77838682a3a906fae1a7b4157f (diff) | |
download | traccar-server-4d540595df864fddbc04d65af55015084a89bf82.tar.gz traccar-server-4d540595df864fddbc04d65af55015084a89bf82.tar.bz2 traccar-server-4d540595df864fddbc04d65af55015084a89bf82.zip |
Schedule reconnection only if current task stopped
-rw-r--r-- | src/org/traccar/smpp/SmppClient.java | 8 |
1 files changed, 5 insertions, 3 deletions
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() { |