[infinispan-dev] Infinispan's dependency injection fwk

Mircea Markus mircea.markus at jboss.com
Thu Jul 22 12:22:00 EDT 2010


Hi,

I have this problem with the the dependency injection fwk in infinispan: many times I'd like to declare the injected dependencies as final fields in order to take advantage[1] of "final" semantics in Java's memory model. I cannot/don't know how to do that, can I annotate an constructor with @Inject? If not I think that would be useful.

[1] @Inject methods are called by the thread that starts the CM. The injected dependencies are cached as local fields and will be accessed by a different application thread. So they'd need volatile/synchronise for proper publishing: afaik volatile is less performant that publishing with final.

wdyt?

Cheers,
Mircea


More information about the infinispan-dev mailing list