Thanks for the feedback, Eduardo. I'll address each one separately, although
Galder's done an excellent job already. :)
On 4 Jan 2011, at 16:12, Eduardo Martins wrote:
>
> Oh right, I see what you mean. You're saying that getCacheManager() in Cache
returns a CacheContainer rather than an EmbeddedCacheManager. There's a reason for
this:
>
> CacheContainer is the common demoninator for operations that are accessible by remote
and local caches. EmbeddedCacheManager extends CacheContainer to add operations that only
make sense on a local basis, whereas RemoteCacheManager does the same for remotely
accessed Infinispan instances. For the moment, you cannot add listeners to remote
cache/cachemanager instances, hence why those methods are only available in
EmbeddedCacheManager.
>
> It might make sense to have an EmbeddedCache interface that ties up this up via
covariant returns, i.e.:
>
> EmbeddedCacheManager getCacheManager();
>
Agree.
This was changed in 4.1.0 when we introduced the RemoteCacheManager (Hot Rod client). But
yeah I appreciate your concerns re: not being able to add a cache manager listener when
all you have is a reference to a cache - however I would have expected that you'd also
have a reference to an EmbeddedCacheManager (since you created the cache!) so you could
add listeners there.
I don't think a covariant return type will work. If Cache.getCacheManager() returns
EmbeddedCacheManager, then RemoteCache.getCacheManager() cannot return RemoteCacheManager
since it isn't a sub-interface of EmbeddedCacheManager.
TBH, RemoteCache.getCacheManager() is a no-op anyway - so I don't see why
Cache.getCacheManager() doesn't just return EmbeddedCacheManager.
Galder, did you create a JIRA for this?
Cheers
Manik
--
Manik Surtani
manik(a)jboss.org
twitter.com/maniksurtani
Lead, Infinispan
http://www.infinispan.org