aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorEdward Valley <ed.valley@yandex.com>2020-01-30 05:33:24 -0500
committerEdward Valley <ed.valley@yandex.com>2020-01-30 05:33:24 -0500
commit3c71ac47b4515fb799e67a18b18d722bea4d2241 (patch)
tree8f74c792bde541b41c2e954faf67288d8d78be4c /src/main/java/org
parent7113e04b9a5cabb509ff0219da18098f4b55924f (diff)
downloadtrackermap-server-3c71ac47b4515fb799e67a18b18d722bea4d2241.tar.gz
trackermap-server-3c71ac47b4515fb799e67a18b18d722bea4d2241.tar.bz2
trackermap-server-3c71ac47b4515fb799e67a18b18d722bea4d2241.zip
Log position forwarding failures
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/WebDataHandler.java36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/main/java/org/traccar/WebDataHandler.java b/src/main/java/org/traccar/WebDataHandler.java
index 2d6d98f5d..e2f7c1e8b 100644
--- a/src/main/java/org/traccar/WebDataHandler.java
+++ b/src/main/java/org/traccar/WebDataHandler.java
@@ -20,6 +20,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.netty.channel.ChannelHandler;
import io.netty.util.Timeout;
import io.netty.util.TimerTask;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.traccar.config.Config;
import org.traccar.config.Keys;
@@ -53,6 +55,8 @@ public class WebDataHandler extends BaseDataHandler {
private static final String KEY_POSITION = "position";
private static final String KEY_DEVICE = "device";
+ private static final Logger LOGGER = LoggerFactory.getLogger(WebDataHandler.class);
+
private final IdentityManager identityManager;
private final ObjectMapper objectMapper;
private final Client client;
@@ -219,19 +223,29 @@ public class WebDataHandler extends BaseDataHandler {
private void retry() {
try {
- if (retryEnabled && deliveryPendingCurrent.get() <= deliveryPendingLimit) {
- GlobalTimer.getTimer().newTimeout(new TimerTask() {
- @Override
- public void run(Timeout timeout) {
- if (!timeout.isCancelled()) {
- if (delay < retryDelayMax) {
- delay++;
+ String message = "Position forwarding failed.";
+ if (!retryEnabled) {
+ LOGGER.warn(message);
+ } else {
+ int pending = deliveryPendingCurrent.get();
+ if (pending <= deliveryPendingLimit) {
+ LOGGER.warn(message + " Pending: " + pending
+ + ". Retrying in " + delay + " seconds.");
+ GlobalTimer.getTimer().newTimeout(new TimerTask() {
+ @Override
+ public void run(Timeout timeout) {
+ if (!timeout.isCancelled()) {
+ if (delay < retryDelayMax) {
+ delay++;
+ }
+ send();
}
- send();
}
- }
- }, delay, TimeUnit.SECONDS);
- return;
+ }, delay, TimeUnit.SECONDS);
+ return;
+ }
+ LOGGER.warn(message + " Pending: " + pending
+ + ". Delivery will not be retried.");
}
} catch (Exception e) {
}