Skip to content

Migrate Executor to TaskQueue #36

Open
@jhansche

Description

@jhansche

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions