[jboss-cvs] JBossCache/src/org/jboss/cache/jmx ...
Brian Stansberry
brian.stansberry at jboss.com
Wed May 23 23:56:34 EDT 2007
User: bstansberry
Date: 07/05/23 23:56:34
Modified: src/org/jboss/cache/jmx LegacyConfiguration.java
CacheJmxWrapper.java
Log:
Support old versions of renamed attributes
Dependency inject MultiplexerService rather than doing JMX lookup
Revision Changes Path
1.5 +25 -10 JBossCache/src/org/jboss/cache/jmx/LegacyConfiguration.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LegacyConfiguration.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/jmx/LegacyConfiguration.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- LegacyConfiguration.java 23 May 2007 20:23:25 -0000 1.4
+++ LegacyConfiguration.java 24 May 2007 03:56:33 -0000 1.5
@@ -23,6 +23,7 @@
import org.jboss.cache.Region;
import org.jgroups.ChannelFactory;
+import org.jgroups.jmx.JChannelFactoryMBean;
import org.w3c.dom.Element;
import javax.management.ObjectName;
@@ -32,7 +33,7 @@
* Legacy configuration attributes from JBC 1.x.
*
* @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public interface LegacyConfiguration
{
@@ -74,6 +75,16 @@
void setExposeManagementStatistics(boolean expose);
/**
+ * @deprecated use {@link #getExposeManagementStatistics()}
+ */
+ boolean getUseInterceptorMbeans();
+
+ /**
+ * @deprecated use {@link #setExposeManagementStatistics(boolean)}
+ */
+ void setUseInterceptorMbeans(boolean expose);
+
+ /**
* Get the cluster properties (e.g. the protocol stack specification in case of JGroups)
*/
String getClusterProperties();
@@ -88,11 +99,21 @@
/**
* Retrieves the cache loader configuration element
*
- * @return whatever was passed to {@link #setCacheLoaderConfiguration(Element)}
+ * @return whatever was passed to {@link #setCacheLoaderConfig(Element)}
* or <code>null</code> if nothing was
*/
+ Element getCacheLoaderConfig();
+
+ void setCacheLoaderConfig(Element cache_loader_config);
+
+ /**
+ * @deprecated use {@link #getCacheLoaderConfig()}
+ */
Element getCacheLoaderConfiguration();
+ /**
+ * @deprecated use {@link #setCacheLoaderConfig(boolean)}
+ */
void setCacheLoaderConfiguration(Element cache_loader_config);
boolean getSyncCommitPhase();
@@ -315,14 +336,8 @@
void setMuxChannelFactory(ChannelFactory factory);
- /**
- * @deprecated directly inject the ChannelFactory via {@link #setMuxChannelFactory(ChannelFactory)}
- */
- ObjectName getMultiplexerService();
+ JChannelFactoryMBean getMultiplexerService();
- /**
- * @deprecated directly inject the ChannelFactory via {@link #setMuxChannelFactory(ChannelFactory)}
- */
- void setMultiplexerService(ObjectName muxService);
+ void setMultiplexerService(JChannelFactoryMBean muxService);
}
\ No newline at end of file
1.25 +41 -23 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.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- CacheJmxWrapper.java 23 May 2007 20:23:25 -0000 1.24
+++ CacheJmxWrapper.java 24 May 2007 03:56:33 -0000 1.25
@@ -39,6 +39,7 @@
import org.jgroups.Address;
import org.jgroups.Channel;
import org.jgroups.ChannelFactory;
+import org.jgroups.jmx.JChannelFactoryMBean;
import org.w3c.dom.Element;
import javax.management.JMException;
@@ -62,7 +63,7 @@
* {@link CacheImpl}.
*
* @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.24 $
+ * @version $Revision: 1.25 $
*/
public class CacheJmxWrapper
extends NotificationBroadcasterSupport
@@ -86,7 +87,7 @@
private Element evictionConfig;
private Element cacheLoaderConfig;
private Element clusterConfig;
- private ObjectName multiplexerService;
+ private JChannelFactoryMBean multiplexerService;
// ----------------------------------------------------------- Constructors
@@ -198,11 +199,18 @@
return buddyReplConfig;
}
- public Element getCacheLoaderConfiguration()
+ public Element getCacheLoaderConfig()
{
return cacheLoaderConfig;
}
+ public Element getCacheLoaderConfiguration()
+ {
+ log.warn("MBean attribute 'CacheLoaderConfiguration' is deprecated; " +
+ "use 'CacheLoaderConfig'");
+ return getCacheLoaderConfig();
+ }
+
public String getCacheMode()
{
return getConfiguration().getCacheModeString();
@@ -233,6 +241,13 @@
return getConfiguration().getExposeManagementStatistics();
}
+ public boolean getUseInterceptorMbeans()
+ {
+ log.warn("MBean attribute 'UseInterceptorMbeans' is deprecated; " +
+ "use 'ExposeManagementStatistics'");
+ return getExposeManagementStatistics();
+ }
+
public boolean getFetchInMemoryState()
{
return getConfiguration().isFetchInMemoryState();
@@ -253,7 +268,7 @@
return getConfiguration().getLockAcquisitionTimeout();
}
- public ObjectName getMultiplexerService()
+ public JChannelFactoryMBean getMultiplexerService()
{
return multiplexerService;
}
@@ -339,7 +354,7 @@
this.buddyReplConfig = config;
}
- public void setCacheLoaderConfiguration(Element cache_loader_config)
+ public void setCacheLoaderConfig(Element cache_loader_config)
{
CacheLoaderConfig clc = null;
if (cache_loader_config != null)
@@ -350,6 +365,13 @@
this.cacheLoaderConfig = cache_loader_config;
}
+ public void setCacheLoaderConfiguration(Element config)
+ {
+ log.warn("MBean attribute 'CacheLoaderConfiguration' is deprecated; " +
+ "use 'CacheLoaderConfig'");
+ setCacheLoaderConfig(config);
+ }
+
public void setCacheMode(String mode) throws Exception
{
getConfiguration().setCacheModeString(mode);
@@ -392,6 +414,13 @@
getConfiguration().setExposeManagementStatistics(expose);
}
+ public void setUseInterceptorMbeans(boolean use)
+ {
+ log.warn("MBean attribute 'UseInterceptorMbeans' is deprecated; " +
+ "use 'ExposeManagementStatistics'");
+ setExposeManagementStatistics(use);
+ }
+
public void setFetchInMemoryState(boolean flag)
{
getConfiguration().setFetchInMemoryState(flag);
@@ -417,7 +446,7 @@
getConfiguration().setLockAcquisitionTimeout(timeout);
}
- public void setMultiplexerService(ObjectName muxService)
+ public void setMultiplexerService(JChannelFactoryMBean muxService)
{
this.multiplexerService = muxService;
}
@@ -867,13 +896,10 @@
// Only inject if there isn't already a channel or factory
if (rtcfg.getMuxChannelFactory() == null && rtcfg.getChannel() == null)
{
- MBeanServer mbs = getMBeanServer();
- if (mbs != null)
- {
Channel ch;
try
{
- ch = (Channel) mbs.invoke(multiplexerService, "createMultiplexerChannel", new Object[]{cfg.getMultiplexerStack(), cfg.getClusterName()}, new String[]{String.class.getName(), String.class.getName()});
+ ch = multiplexerService.createMultiplexerChannel(cfg.getMultiplexerStack(), cfg.getClusterName());
}
catch (Exception e)
{
@@ -881,14 +907,6 @@
}
rtcfg.setChannel(ch);
}
- else
- {
- throw new CacheException("Cannot access " + multiplexerService +
- " as no MBeanServer is available. Register this MBean with " +
- "the JMX server before calling create()");
- }
- }
-
}
More information about the jboss-cvs-commits
mailing list