mozilla-services/android-sync — pull request #290 by ncalexan (2013-01-30 20:12:18+00:00)
Title: Bug 814750 - execution queue

This uses an execution service rather than the existing nested stack for executing global sync stages.

The final two commits are there for comments only -- they show what a stage factory might look like. We could go this direction, or not -- I'm not particularly tied to it, and made earlier changes (construction flow) that make the factory pattern less appealing.

One reason to use the execution service was to "explicitly release" stages that had been executed so that we could GC them. Two comments:
* stages can be executed multiple times (reset, wipe, execute), including possibly after a `restart`, so this is hard to do without calling `prepareStages` multiple times, at which point we should just use the factory.
* stages actually use very little memory, so GCing them is mostly for hygiene and clarity of lifecycles; lifecycle seems better conveyed by the factory pattern.

Thoughts?