Hi Tasos,

module.newTransientBuilder() and module.newValueBuilder() are
implemented in org.qi4j.core.runtime.ModuleInstance, they both rely on
TypeLookup in the same package, should be thread-safe, on each call they
return a new Builder instance.

Using putIfAbsent() in TypeLookup would mean that the type-lookup should
be done on each call. That would defeat the actual caching of
type-lookup and, from what I understand, not solve any synchronization
issue. With the actual code, under immediate pressure, the lookup can be
executed a few times before caching is effective but this should not
cause any race-condition. With Java 8 we'll be able to use
computeIfAbsent() to optimize this, will do in 3.0.

Would it be possible for you to build a sample program that showcase the
issue?
I know it's quite difficult when it comes to concurrency issues ... but
it's also hard to narrow it down without such a showcase.

Cheers

/Paul

Reply via email to