From a22dbba08c588521f6e0846f723508a3d1e56490 Mon Sep 17 00:00:00 2001 From: Ruben Moral Date: Mon, 28 Jan 2019 17:20:04 +0100 Subject: [PATCH] abstract: synchronize method to get next frame ID to avoid multiple threads to increment the counter at the same time This could fix an issue of a customer getting sometimes an IllegalArgumentException when sending data (#130). Signed-off-by: Ruben Moral --- library/src/main/java/com/digi/xbee/api/AbstractXBeeDevice.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/java/com/digi/xbee/api/AbstractXBeeDevice.java b/library/src/main/java/com/digi/xbee/api/AbstractXBeeDevice.java index 2812e33a..7e3d0b6c 100644 --- a/library/src/main/java/com/digi/xbee/api/AbstractXBeeDevice.java +++ b/library/src/main/java/com/digi/xbee/api/AbstractXBeeDevice.java @@ -1460,7 +1460,7 @@ private void writePacket(XBeePacket packet) throws IOException { * * @return The next Frame ID. */ - protected int getNextFrameID() { + protected synchronized int getNextFrameID() { if (isRemote()) return localXBeeDevice.getNextFrameID(); if (currentFrameID == 0xff) {