[jboss-cvs] JBossAS SVN: r60110 - branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 30 00:52:14 EST 2007
Author: bstansberry at jboss.com
Date: 2007-01-30 00:52:14 -0500 (Tue, 30 Jan 2007)
New Revision: 60110
Modified:
branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java
Log:
[JBAS-4013] Add ability to use multiplexer to ClusterPartition
Modified: branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java 2007-01-29 22:11:54 UTC (rev 60109)
+++ branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java 2007-01-30 05:52:14 UTC (rev 60110)
@@ -41,8 +41,10 @@
import org.jboss.system.ServiceMBeanSupport;
import org.jboss.system.server.ServerConfigUtil;
import org.jgroups.Channel;
+import org.jgroups.JChannel;
import org.jgroups.Version;
import org.jgroups.debug.Debugger;
+import org.jgroups.jmx.JChannelFactoryMBean;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -84,6 +86,8 @@
protected HAPartitionImpl partition;
protected boolean deadlock_detection = false;
protected boolean allow_sync_events = false;
+ protected JChannelFactoryMBean multiplexer = null;
+ protected String stackName = null;
protected org.jgroups.JChannel channel;
protected Debugger debugger=null;
protected boolean use_debugger=false;
@@ -119,7 +123,16 @@
public String getPartitionProperties()
{
- return jgProps;
+ // The channel knows best
+ if (channel != null)
+ return channel.getProperties();
+
+ if (multiplexer == null && stackName == null)
+ return jgProps;
+
+ // We are configured for the multiplexer but don't know
+ // the details of the stack yet
+ return null;
}
public void setPartitionProperties(String newProps)
@@ -224,6 +237,26 @@
this.method_call_timeout=timeout;
}
+ public JChannelFactoryMBean getMultiplexer()
+ {
+ return multiplexer;
+ }
+
+ public void setMultiplexer(JChannelFactoryMBean muxFactory)
+ {
+ this.multiplexer = muxFactory;
+ }
+
+ public String getMultiplexerStack()
+ {
+ return stackName;
+ }
+
+ public void setMultiplexerStack(String stackName)
+ {
+ this.stackName = stackName;
+ }
+
// public boolean getChannelDebugger()
// {
// return this.use_debugger;
@@ -286,7 +319,15 @@
{
log.debug("Creating JGroups JChannel");
- this.channel = new org.jgroups.JChannel(jgProps);
+ if (stackName != null && multiplexer != null)
+ {
+ this.channel = (JChannel) multiplexer.createMultiplexerChannel(stackName, getPartitionName());
+ }
+ else
+ {
+ this.channel = new org.jgroups.JChannel(jgProps);
+ }
+
if(use_debugger && debugger == null)
{
debugger=new Debugger(channel);
Modified: branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java
===================================================================
--- branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java 2007-01-29 22:11:54 UTC (rev 60109)
+++ branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java 2007-01-30 05:52:14 UTC (rev 60110)
@@ -28,6 +28,7 @@
import org.jboss.ha.framework.interfaces.HAPartition;
import org.jboss.mx.util.ObjectNameFactory;
+import org.jgroups.jmx.JChannelFactoryMBean;
import org.w3c.dom.Element;
/**
@@ -56,6 +57,10 @@
/**
* Get JGroups property string a la JDBC
* see <a href="http://www.jgroups.com/">JGroups web site for more information</a>
+ *
+ * @return the protocol stack used by this ClusterPartition, or <code>null</code>
+ * if the {@link #setMultiplexer(JChannelFactoryMBean) multiplexer} is
+ * configured but the channel has not been created yet.
*/
String getPartitionProperties(); // i.e. JGroups properties
void setPartitionProperties(String newProps);
@@ -69,7 +74,10 @@
<PING timeout="2000" />
<MERGE2 min_interval="5000" max_interval="10000" />
<FD />
- </JGProps>
+ </JGProps>
+ * <p/>
+ * Ignored if the {@link #setMultiplexer(JChannelFactoryMBean) multiplexer} is
+ * used.
*/
void setPartitionConfig(Element config);
@@ -101,8 +109,50 @@
long getMethodCallTimeout();
void setMethodCallTimeout(long timeout);
+
+ /**
+ * Gets the multiplexer channel factory that should be used to
+ * create the JGroups channel.
+ *
+ * @return the multiplexed channel factory, or <code>null</code> if
+ * one isn't configured
+ */
+ JChannelFactoryMBean getMultiplexer();
+
+ /**
+ * Sets the multiplexer channel factory that should be used to
+ * create the JGroups channel. If this and a
+ * {@link #setMultiplexerStack() multiplexer stack name} are set,
+ * the channel will come from the multiplexer and properties
+ * {@link #setPartitionConfig(Element) partitionConfig} and
+ * {@link #setPartitionProperties(String) partitionProperties} will be
+ * ingored.
+ */
+ void setMultiplexer(JChannelFactoryMBean muxFactory);
+ /**
+ * Gets the name of the protocol stack the multiplexer channel factory
+ * should use to create the JGroups channel.
+ *
+ * @return the stack name, or <code>null</code>
+ */
+ String getMultiplexerStack();
+
+ /**
+ * Sets the name of the protocol stack the multiplexer channel factory
+ * should use to create the JGroups channel. If this and a
+ * {@link #setMultiplexer() multiplexed channel factory} are set,
+ * the channel will come from the multiplexer and properties
+ * {@link #setPartitionConfig(Element) partitionConfig} and
+ * {@link #setPartitionProperties(String) partitionProperties} will be
+ * ingored.
+ *
+ * @param stackName the name of one of the protocols stacks included
+ * in the multiplexed channel factor's configuration
+ */
+ void setMultiplexerStack(String stackName);
+
// boolean getChannelDebugger();
// void setChannelDebugger(boolean flag);
More information about the jboss-cvs-commits
mailing list