From b5e2961834744f08dfb6bf047f41cb567f5d5ea5 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Wed, 22 May 2019 13:48:49 -0500 Subject: [PATCH] Convert NetworkService's sendMessage to synchronized, to guarantee thread safety: to avoid issues when calling that method from different threads. --- .../java/cy/agorise/graphenej/api/android/NetworkService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java index c92880f..8010e11 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java @@ -255,7 +255,7 @@ public class NetworkService extends Service { * constants specified in the ApiAccess class. * @return The id of the message that was just sent, or -1 if no message was sent. */ - public long sendMessage(ApiCallable apiCallable, int requiredApi){ + public synchronized long sendMessage(ApiCallable apiCallable, int requiredApi){ if(requiredApi != -1 && mApiIds.containsKey(requiredApi) || requiredApi == ApiAccess.API_NONE){ int apiId = 0; if(requiredApi != ApiAccess.API_NONE)