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: 297
        
design-patterns
I'm looking for a design pattern that addresses the following situation:
- There exists a list of tasks that must be processed. 
- Tasks may be added at any time. 
- Each task is wholly independent from all other tasks. 
- The order in which tasks are processed has no effect on the overall system or on the tasks themselves. 
- Every task must be processed once and only once. 
- 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