[infinispan-dev] thoughts on CacheLoader concurrency

Manik Surtani manik at jboss.org
Mon May 24 09:28:01 EDT 2010


On 24 May 2010, at 13:41, Mircea Markus wrote:

> Hi,
> 
> AbstractCacheLoader.int looks like this:
> 
>   @Override
>   public void init(CacheLoaderConfig config, Cache<?, ?> cache, Marshaller m) throws CacheLoaderException {
>      this.marshaller = m;
>      if (config == null) throw new IllegalStateException("Null config!!!");
>      this.cache = cache;
>   }
> 
> This sets the non-volatile fields marshaller and cache.  AbstractCacheLoader.int is called by the thread that starts the CacheManager which is different from e.g. expiration thread or other application threads. Shouldn't we safely publish  these fields by making them volatile?

Fair point, it makes sense.

--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org







More information about the infinispan-dev mailing list