
|
If you were logged in you would be able to see more operations.
|
|
|
|
Create a CacheEntryEventListener and register with:
class MyEntryEventListener implements CacheEntryEventListener{
...
}
MyEntryEventListener listener = new MyEntryEventListener();
// This call succeeds because CacheEventListener.isAssignableFrom(listener.getClass())
cacheAdmin.getCache().addCacheEventListener(listener, listener.getClass());
-------------------------
This listener is never invoked because Cache.dispatchCacheEntryEvent has a guard condition:
if (listener[i]==CacheEntryEventListener.class){
// notify next object in the list
}
This is incorrect it should use isAssignableFrom() or better yet, remove altogether. It is not needed since addCacheEventListener(listener, listener.getClass()); already does the validation.
Note that it would also be better to deprecate addCacheEventListener(CacheEventListener listener, Class clazz); and replace with
addCacheEventListener(CacheEventListener listener); Why do you need to pass the class as a parameter (except to work around this bug)?
The class should be determined using listener.getClass();
|
|
Description
|
Create a CacheEntryEventListener and register with:
class MyEntryEventListener implements CacheEntryEventListener{
...
}
MyEntryEventListener listener = new MyEntryEventListener();
// This call succeeds because CacheEventListener.isAssignableFrom(listener.getClass())
cacheAdmin.getCache().addCacheEventListener(listener, listener.getClass());
-------------------------
This listener is never invoked because Cache.dispatchCacheEntryEvent has a guard condition:
if (listener[i]==CacheEntryEventListener.class){
// notify next object in the list
}
This is incorrect it should use isAssignableFrom() or better yet, remove altogether. It is not needed since addCacheEventListener(listener, listener.getClass()); already does the validation.
Note that it would also be better to deprecate addCacheEventListener(CacheEventListener listener, Class clazz); and replace with
addCacheEventListener(CacheEventListener listener); Why do you need to pass the class as a parameter (except to work around this bug)?
The class should be determined using listener.getClass(); |
Show » |
|