Convert NetworkService's sendMessage to synchronized, to guarantee thread safety: to avoid issues when calling that method from different threads.

develop
Severiano Jaramillo 2019-05-22 13:48:49 -05:00
parent d29f937045
commit b5e2961834
1 changed files with 1 additions and 1 deletions

View File

@ -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)