make FlattrService creation and deletion synchronized
This commit is contained in:
parent
748d2bc863
commit
a7d00f952c
|
@ -15,14 +15,14 @@ public class FlattrServiceCreator {
|
||||||
|
|
||||||
private static volatile FlattrService flattrService;
|
private static volatile FlattrService flattrService;
|
||||||
|
|
||||||
public static FlattrService getService(AccessToken token) {
|
public synchronized static FlattrService getService(AccessToken token) {
|
||||||
if (flattrService == null) {
|
if (flattrService == null) {
|
||||||
flattrService = FlattrFactory.getInstance().createFlattrService(token);
|
flattrService = FlattrFactory.getInstance().createFlattrService(token);
|
||||||
}
|
}
|
||||||
return flattrService;
|
return flattrService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void deleteFlattrService() {
|
public synchronized static void deleteFlattrService() {
|
||||||
if (BuildConfig.DEBUG) Log.d(TAG, "Deleting service instance");
|
if (BuildConfig.DEBUG) Log.d(TAG, "Deleting service instance");
|
||||||
flattrService = null;
|
flattrService = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue