Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Executor to TaskQueue #36

Open
jhansche opened this issue Mar 27, 2017 · 3 comments
Open

Migrate Executor to TaskQueue #36

jhansche opened this issue Mar 27, 2017 · 3 comments

Comments

@jhansche
Copy link
Contributor

Current implementation uses Executor, which makes it harder to perform scheduled tasks or to perform task chaining. Currently tasks are enqueued by invoking a static method:

        return Task.call(new Callable<Void>() {
            public Void call() throws Exception {
                // ... do the work ...
                return null;
            }
        }, taskExecutor);

Typical Parse code is written using TaskQueue instead:

    return taskQueue.enqueue(new Continuation<Void, Task<Void>>() {
      @Override
      public Task<Void> then(Task<Void> toAwait) throws Exception {
        return toAwait.continueWithTask(new Continuation<Void, Task<Void>>() {
          @Override
          public Task<Void> then(Task<Void> task) throws Exception {
            // ... do the work ...
            return <a task that resolves when the work is complete>;
          }
        });
      }
    });

The end result is largely the same, but using TaskQueue will help keep the architecture more in line with what is already established in Parse-SDK-Android.

@rogerhu
Copy link
Contributor

rogerhu commented Mar 28, 2017

Basically using the bolts framework right?

@jhansche
Copy link
Contributor Author

Yeah, that's the idea. Updating the client to work more like how the existing parse platform is already written.

@mmimeault
Copy link
Contributor

Sorry it was my first time using that Framework when I made the initial project. I tried to do the same as how it's done in the existing parse platform.
Thanks, and I'll learn about it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants