This content has been marked as final.
Show 1 reply
-
1. Re: Node Removal In mvcc-entity Cache Through JMX Console
burnison Feb 10, 2009 9:07 PM (in response to frank.stillford)"frank.stillford" wrote:
... If not, are there any similar alternatives or workarounds?
I have not found a way to invalidate entities out-of-the-box, but you can create your own MBean to accomplish the task. You can get a handle on the CacheManager through JNDI, and you can obtain a reference to the entity cache thusly:public void remove(String jndi, String cacheName, String node) throws Exception { CacheManager cm = null; Cache<?, ?> c = null; try{ cm = this.getCacheManager(jndi); c = cm.getCache(cacheName, false); c.removeNode(node); } finally{ if(c != null){ try { cm.releaseCache(cacheName); } catch (NamingException ex) { } } } } private CacheManager getCacheManager(String jndi) throws NamingException { Context ic = null; try{ ic = new InitialContext(); return (CacheManager)ic.lookup(jndi); } finally { if(ic != null) { try { ic.close(); } catch (NamingException ex) { } } } }
By default, the cache manager is bound to java:/CacheManager.
Regards,
Richard Burnison