[infinispan-dev] CacheContainer.getCache

Galder Zamarreño galder at redhat.com
Wed Dec 1 05:30:29 EST 2010


On Nov 30, 2010, at 7:00 PM, Mircea Markus wrote:

> Hi,
> 
> if there is no such cache defined in the configuration with name "undefinedCacheName" and CacheContainer.getCache("undefinedCacheName") is called then an cache with default configuration and that name is first defined and then instantiated and returned. 
> Anyone remembers what the requirement were for this is?
> IMO an exception should be thrown and user should be notified that the cache is not defined. This way we can fail fast e.g. If the user forgets to define a cache or misspells its name.
> If this behaviour is needed, an approach would be to create an specialised method to handle this: getAndDefineCache...

I can't remember about the req, but it could make sense to differentiate between the two cases. I think someone else provided similar feedback a few months ago.

I do think though that getCache should remain as is, and instead have a separate method that gets only if defined.

> 
> There is code that already relies on the fact that the cache is already defined: see InboundInvocationHandler.handle.
> 
> Cheers,
> Mircea
> 
> 
> 
> 
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache




More information about the infinispan-dev mailing list