On Mon, Dec 14, 2009 at 11:24 PM, Eugene M. Hutorny <[email protected]> wrote:
>> Mixins can be considered injected at 'creation time' and they won't >> change. But for the other fragments, they can be re-used between >> method calls (still of the same Composite Type) into different >> instances, so for instance @This would potentially change. This drives >> the "you can't keep inter-method state in Concerns" requirement, since >> there are no guarantees that the same Concern will be used next time, >> or that the next call is in the same composite. > > Is it thread-safe by design or, instead, a concern developer should take > some actions to ensure the thread-safity? Concerns, SideEffects and Constraints are thread-safe by definition, as each method invocation will use a free and available invocation stack (those glued together). Mixins are not necessarily thread-safe. - Values' mixins should be thread-safe by definition of Values, i.e. no mutable state. However, it is technically possible for mixins to have non-Property members that it modifies and that would be the fault of the programmer. - For Entities the Mixins are thread-safe by design, since the UnitOfWork is thread-local and the Entity is bound to a unit of work while being used. The 'sideeffect' of this is that an Entity can not transcend the thread boundary, i.e. you can't hand a Entity to another thread for processing, instead that must be done via Identity and a new UoW in that thread. - Transients' and Services' mixins are not thread-safe and the developer needs to deal with it. Hope that helps. Cheers -- Niclas Hedhman, Software Developer http://www.qi4j.org - New Energy for Java I live here; http://tinyurl.com/2qq9er I work here; http://tinyurl.com/2ymelc I relax here; http://tinyurl.com/2cgsug _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

