Processing a list of atomic operations, allowing for interruptions

Posted by JDB on Programmers See other posts from Programmers or by JDB
Published on 2014-06-03T14:10:07Z Indexed on 2014/06/03 15:53 UTC
Read the original article Hit count: 190

Filed under:

I'm looking for a design pattern that addresses the following situation:

  1. There exists a list of tasks that must be processed.

  2. Tasks may be added at any time.

  3. Each task is wholly independent from all other tasks.

  4. The order in which tasks are processed has no effect on the overall system or on the tasks themselves.

  5. Every task must be processed once and only once.

  6. The "main" process which launches the task processors may start and stop without warning. When stopped, the "main" process loses all in-memory data.

Obviously this is going to involve some state, but are there any design patterns which discuss where and how to maintain that state? Are there any relevant anti-patterns?

Named patterns are especially helpful so that we can discuss this topic with other organizations without having to describe the entire problem domain.

© Programmers or respective owner

Related posts about design-patterns