[infinispan-dev] CacheContainer.getCache

Mircea Markus mircea.markus at jboss.com
Tue Nov 30 13:00:06 EST 2010


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...

There is code that already relies on the fact that the cache is already defined: see InboundInvocationHandler.handle.

Cheers,
Mircea






More information about the infinispan-dev mailing list