Convert NetworkService's sendMessage to synchronized, to guarantee thread safety: to avoid issues when calling that method from different threads.
This commit is contained in:
parent
d29f937045
commit
b5e2961834
1 changed files with 1 additions and 1 deletions
|
@ -255,7 +255,7 @@ public class NetworkService extends Service {
|
||||||
* constants specified in the ApiAccess class.
|
* constants specified in the ApiAccess class.
|
||||||
* @return The id of the message that was just sent, or -1 if no message was sent.
|
* @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){
|
if(requiredApi != -1 && mApiIds.containsKey(requiredApi) || requiredApi == ApiAccess.API_NONE){
|
||||||
int apiId = 0;
|
int apiId = 0;
|
||||||
if(requiredApi != ApiAccess.API_NONE)
|
if(requiredApi != ApiAccess.API_NONE)
|
||||||
|
|
Loading…
Reference in a new issue