excilys/androidannotations — pull request #564 by rom1v (2013-04-18 14:10:25+00:00)
Title: Serial execution in background

Inspired by the ideas of #309, I propose an alternative implementation for providing a serialized execution of background tasks.

The purpose is to add an optional serial attribute to `@Background`

~~~java
@Background(serial="some_id")
~~~

so that calls to `@Background` annotated method having the same non-null serial are guaranteed to be executed one at a time, in the order (but not necessarily in the same thread).

It is still compatible with the `delay` attribute. For example:

~~~java
@Background(serial="some_id", delay=2000)
~~~

executes the task in background after at least 2 seconds **and** after the previous task requested with `serial="some_id"` (if any) have completed execution.

Of course, if two methods use a different `serial`, they are *independant* (no serial execution constraint) and will be executed in parallel.

Please don't hesitate if you have any questions or feedbacks.