[jboss-cvs] JBossCache/src/org/jboss/cache/jmx ...
Manik Surtani
msurtani at jboss.com
Thu Nov 16 09:14:11 EST 2006
User: msurtani
Date: 06/11/16 09:14:11
Modified: src/org/jboss/cache/jmx CacheJmxWrapper.java
CacheMBean.java Cache.java
Log:
Fixed JMX related crapola
Revision Changes Path
1.7 +34 -7 JBossCache/src/org/jboss/cache/jmx/CacheJmxWrapper.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheJmxWrapper.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/jmx/CacheJmxWrapper.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- CacheJmxWrapper.java 14 Nov 2006 21:54:00 -0000 1.6
+++ CacheJmxWrapper.java 16 Nov 2006 14:14:11 -0000 1.7
@@ -21,11 +21,6 @@
*/
package org.jboss.cache.jmx;
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Cache;
@@ -33,6 +28,17 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.factories.DefaultCacheFactory;
+import org.jboss.cache.interceptors.CacheMgmtInterceptor;
+import org.jboss.cache.interceptors.Interceptor;
+
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
public class CacheJmxWrapper implements CacheJmxWrapperMBean, MBeanRegistration
{
@@ -122,8 +128,6 @@
/**
* Caches the provided <code>server</code> and <code>objName</code>.
*
- * @return either <code>objName</code>, or, if a name was previously assigned
- * via {@link #setPojoCacheObjectName(String)}, that name.
*/
public ObjectName preRegister(MBeanServer server, ObjectName objName)
throws Exception
@@ -286,4 +290,27 @@
}
}
+ public void addNotificationListener(NotificationListener notificationListener, NotificationFilter notificationFilter, Object object) throws IllegalArgumentException
+ {
+ getCacheMgmtInterceptor().addNotificationListener(notificationListener, notificationFilter, object);
+ }
+
+ public void removeNotificationListener(NotificationListener notificationListener) throws ListenerNotFoundException
+ {
+ getCacheMgmtInterceptor().removeNotificationListener(notificationListener);
+ }
+
+ public MBeanNotificationInfo[] getNotificationInfo()
+ {
+ return getCacheMgmtInterceptor().getNotificationInfo();
+ }
+
+ private CacheMgmtInterceptor getCacheMgmtInterceptor()
+ {
+ for (Interceptor i : tcpi.treeCache.getInterceptors())
+ {
+ if (i instanceof CacheMgmtInterceptor) return (CacheMgmtInterceptor) i;
+ }
+ throw new RuntimeException("Cache management interceptor not found");
+ }
}
1.6 +3 -1 JBossCache/src/org/jboss/cache/jmx/CacheMBean.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheMBean.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/jmx/CacheMBean.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- CacheMBean.java 7 Sep 2006 13:52:28 -0000 1.5
+++ CacheMBean.java 16 Nov 2006 14:14:11 -0000 1.6
@@ -9,12 +9,14 @@
import org.jboss.cache.Cache;
import org.jboss.cache.config.Configuration;
+import javax.management.NotificationBroadcaster;
+
/**
* JMX interface to the {@link org.jboss.cache.Cache}
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
*/
-public interface CacheMBean extends LifeCycle
+public interface CacheMBean extends LifeCycle, NotificationBroadcaster
{
/**
* Retrieves a reference to the underlying {@link Cache}
1.4 +31 -0 JBossCache/src/org/jboss/cache/jmx/Cache.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Cache.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/jmx/Cache.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- Cache.java 7 Sep 2006 13:52:28 -0000 1.3
+++ Cache.java 16 Nov 2006 14:14:11 -0000 1.4
@@ -2,8 +2,15 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.TreeCacheProxyImpl;
+import org.jboss.cache.interceptors.CacheMgmtInterceptor;
+import org.jboss.cache.interceptors.Interceptor;
import org.jboss.cache.config.Configuration;
+import javax.management.NotificationListener;
+import javax.management.NotificationFilter;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+
/**
* JMX object that operates on the cache
*
@@ -52,4 +59,28 @@
{
return tcpi.treeCache.printDetails();
}
+
+ public void addNotificationListener(NotificationListener notificationListener, NotificationFilter notificationFilter, Object object) throws IllegalArgumentException
+ {
+ getCacheMgmtInterceptor().addNotificationListener(notificationListener, notificationFilter, object);
+ }
+
+ public void removeNotificationListener(NotificationListener notificationListener) throws ListenerNotFoundException
+ {
+ getCacheMgmtInterceptor().removeNotificationListener(notificationListener);
+ }
+
+ public MBeanNotificationInfo[] getNotificationInfo()
+ {
+ return getCacheMgmtInterceptor().getNotificationInfo();
+ }
+
+ private CacheMgmtInterceptor getCacheMgmtInterceptor()
+ {
+ for (Interceptor i : tcpi.treeCache.getInterceptors())
+ {
+ if (i instanceof CacheMgmtInterceptor) return (CacheMgmtInterceptor) i;
+ }
+ throw new RuntimeException("Cache management interceptor not found");
+ }
}
More information about the jboss-cvs-commits
mailing list