make FlattrService creation and deletion synchronized

This commit is contained in:
Domingos Lopes 2016-03-22 11:36:24 -04:00
parent 748d2bc863
commit a7d00f952c
1 changed files with 2 additions and 2 deletions

View File

@ -15,14 +15,14 @@ public class FlattrServiceCreator {
private static volatile FlattrService flattrService;
public static FlattrService getService(AccessToken token) {
public synchronized static FlattrService getService(AccessToken token) {
if (flattrService == null) {
flattrService = FlattrFactory.getInstance().createFlattrService(token);
}
return flattrService;
}
public static void deleteFlattrService() {
public synchronized static void deleteFlattrService() {
if (BuildConfig.DEBUG) Log.d(TAG, "Deleting service instance");
flattrService = null;
}