[jboss-user] [EJB/JBoss] - Re: Node Removal In mvcc-entity Cache Through JMX Console
Burnison
do-not-reply at jboss.com
Tue Feb 10 21:07:33 EST 2009
"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
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4208811#4208811
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4208811
More information about the jboss-user
mailing list