[teiid-commits] teiid SVN: r1149 - in trunk: common-core/src/main/java/com/metamatrix/common/util and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Fri Jul 17 14:29:26 EDT 2009


Author: rareddy
Date: 2009-07-17 14:29:25 -0400 (Fri, 17 Jul 2009)
New Revision: 1149

Added:
   trunk/embedded/src/test/resources/log4j.properties
Modified:
   trunk/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java
   trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java
Log:
TEIID-485: Correctly registering the JMX beans for the Cache

Modified: trunk/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java	2009-07-17 17:57:05 UTC (rev 1148)
+++ trunk/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java	2009-07-17 18:29:25 UTC (rev 1149)
@@ -31,6 +31,7 @@
 import org.jboss.cache.eviction.LFUAlgorithmConfig;
 import org.jboss.cache.eviction.LRUAlgorithmConfig;
 import org.jboss.cache.eviction.MRUAlgorithmConfig;
+import org.jboss.cache.jmx.JmxRegistrationManager;
 
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
@@ -49,18 +50,18 @@
 	private static final String NAME = "Cache"; //$NON-NLS-1$
 	private org.jboss.cache.Cache cacheStore;
 	private volatile boolean destroyed = false;
-	private JMXUtil jmx; 
+	JmxRegistrationManager jmxManager;
 	
 	@Inject
 	public JBossCacheFactory(org.jboss.cache.Cache cacheStore, @Named("jmx") JMXUtil jmx) {
 		this.cacheStore =  cacheStore;
-//		try {
-//			this.jmx = jmx;
-//			//jmx.register(JMXUtil.MBeanType.SERVICE, NAME, cacheStore); 
-//			this.cacheStore =  cacheStore;
-//		} catch (FailedToRegisterException e) {
-//			throw new MetaMatrixRuntimeException(e.getCause());
-//		}
+		try {
+			this.cacheStore =  cacheStore;
+			jmxManager = new JmxRegistrationManager(jmx.getMBeanServer(), cacheStore, jmx.buildName(JMXUtil.MBeanType.SERVICE, NAME));
+			jmxManager.registerAllMBeans();
+		} catch (FailedToRegisterException e) {
+			throw new MetaMatrixRuntimeException(e.getCause());
+		}
 	}
 
 	/**
@@ -109,13 +110,6 @@
 	}    
 	
 	public void destroy() {
-//		try {
-//			jmx.unregister(JMXUtil.MBeanType.SERVICE, NAME);
-//		} catch (FailedToRegisterException e) {
-//		} finally {
-//			this.cacheStore.destroy();
-//			this.destroyed = true;
-//		}
+		jmxManager.unregisterAllMBeans();
 	}	
-	
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java	2009-07-17 17:57:05 UTC (rev 1148)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java	2009-07-17 18:29:25 UTC (rev 1149)
@@ -72,10 +72,15 @@
 			throw new FailedToRegisterException(e);
 		}
 	}
+
+	public MBeanServer getMBeanServer() {
+		return mbs;
+	}
 	
 	public static class FailedToRegisterException extends MetaMatrixCoreException{
 		public FailedToRegisterException(Throwable e) {
 			super(e);
 		}
 	}
+	
 }

Added: trunk/embedded/src/test/resources/log4j.properties
===================================================================
--- trunk/embedded/src/test/resources/log4j.properties	                        (rev 0)
+++ trunk/embedded/src/test/resources/log4j.properties	2009-07-17 18:29:25 UTC (rev 1149)
@@ -0,0 +1,31 @@
+#### Log4J configuration for Teiid
+## Available log levels are TRACE,DEBUG,INFO,WARN,ERROR and FATAL
+##
+log4j.rootCategory=FATAL, TEIID
+
+# Print only messages of priority ERROR or higher for your category
+# This is for JGroups
+log4j.category.org.jgroups=WARN
+
+# JBoss transactions
+log4j.category.com.arjuna=WARN
+
+# This one controls for JBoss Cache
+log4j.category.org.jboss=WARN
+
+# This one controls Teiid 
+log4j.category.org.teiid=WARN
+
+# un-comment for command logging (user, source commands submitted)
+#log4j.category.org.teiid.COMMAND_LOG=INFO
+
+# un-comment for audit logging
+#log4j.category.org.teiid.AUDIT_LOG=INFO
+
+# Appender writes to a file
+# Control the maximum log file size, number of backup files
+log4j.appender.TEIID=org.apache.log4j.ConsoleAppender
+
+# layout {date, priority, thread, category, message, newline}
+log4j.appender.TEIID.layout=org.apache.log4j.PatternLayout
+log4j.appender.TEIID.layout.ConversionPattern=%d %p [%t] %c - %m%n
\ No newline at end of file


Property changes on: trunk/embedded/src/test/resources/log4j.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain



More information about the teiid-commits mailing list