Skip to content

Commit cad0e6e

Browse files
committed
Merge pull request #361 from ParsePlatform/wangmengyan.make_initialize_eventuallyQueue_not_reply_on_ParsePlugins
Make eventuallyQueue initialization not rely on ParsePlugins
2 parents 0a05514 + 14f8570 commit cad0e6e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Parse/src/main/java/com/parse/Parse.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.HashSet;
3131
import java.util.List;
3232
import java.util.Set;
33+
import java.util.concurrent.Callable;
3334

3435
import bolts.Continuation;
3536
import bolts.Task;
@@ -402,13 +403,14 @@ public static void initialize(Configuration configuration) {
402403
// Make sure the data on disk for Parse is for the current
403404
// application.
404405
checkCacheApplicationId();
405-
new Thread("Parse.initialize Disk Check & Starting Command Cache") {
406+
final Context context = configuration.context;
407+
Task.callInBackground(new Callable<Void>() {
406408
@Override
407-
public void run() {
408-
// Trigger the command cache to flush its contents.
409-
getEventuallyQueue();
409+
public Void call() throws Exception {
410+
getEventuallyQueue(context);
411+
return null;
410412
}
411-
}.start();
413+
});
412414

413415
ParseFieldOperations.registerDefaultDecoders();
414416

@@ -600,6 +602,10 @@ static void checkCacheApplicationId() {
600602
*/
601603
/* package */ static ParseEventuallyQueue getEventuallyQueue() {
602604
Context context = ParsePlugins.Android.get().applicationContext();
605+
return getEventuallyQueue(context);
606+
}
607+
608+
private static ParseEventuallyQueue getEventuallyQueue(Context context) {
603609
synchronized (MUTEX) {
604610
boolean isLocalDatastoreEnabled = Parse.isLocalDatastoreEnabled();
605611
if (eventuallyQueue == null

0 commit comments

Comments
 (0)