As pointed out by Amin in ISPN-333 [1], we instantiate all cache loader/store impls twice,
if configured via XML. This is so that the configuration parser is able to call
CacheLoader.getConfigurationClass() to get a hold of the corresponding CacheLoaderConfig
instance to set it up. This additional instantiation is only incurred when starting a
cache so it isn't really on the critical path, but as of Infinispan 4.1 (trunk at the
moment) there is another way to provide this information, which will prevent unnecessary
instantiation.
I just checked in the @CacheLoaderMetadata [2] annotation which you can use to annotate
your cache loader/store implementation, which will prevent it from being instantiated
twice since the CacheLoaderConfig type can be provided via this annotation.
Enjoy
Manik
[1]
https://jira.jboss.org/jira/browse/ISPN-333
[2]
http://fisheye.jboss.org/changelog/Infinispan/trunk?cs=1578
--
Manik Surtani
manik(a)jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org