[jboss-cvs] JBossAS SVN: r71350 - in trunk/cluster/src: resources/jgroups and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Mar 27 10:45:47 EDT 2008
Author: bstansberry at jboss.com
Date: 2008-03-27 10:45:47 -0400 (Thu, 27 Mar 2008)
New Revision: 71350
Added:
trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactoryMBean.java
Modified:
trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactory.java
trunk/cluster/src/resources/jgroups/jgroups-channelfactory-beans.xml
Log:
[JBAS-5311] Remove compile-time dependence on org.jgroups.jmx.JChannelFactoryMBean
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactory.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactory.java 2008-03-27 14:45:41 UTC (rev 71349)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactory.java 2008-03-27 14:45:47 UTC (rev 71350)
@@ -39,10 +39,11 @@
* of "additional_data" to the channel config.
*
* @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
- * @version $Revision$
+ *
+ * @version $Revision: 69425 $
*/
public class JChannelFactory extends org.jgroups.JChannelFactory
- implements org.jgroups.jmx.JChannelFactoryMBean
+ implements JChannelFactoryMBean
{
protected static Logger log = Logger.getLogger(JChannelFactory.class);
@@ -61,6 +62,8 @@
private boolean assignLogicalAddresses = true;
/**
+ * {@inheritDoc}
+ *
* Overrides the superclass version by generating a unique node id
* and passing it down the Channel as additional_data and by suppressing the
* <code>register_for_state_transfer</code> param.
@@ -68,15 +71,6 @@
* The additional data is the value of {@link #getNodeName()} which either
* can be injected as part of configuration or will be calculated
* the first time a channel is created.
- * <p/>
- * Suppressing the <code>register_for_state_transfer</code> param is necessary
- * to avoid issues that occur with JGroups when it is <code>true</code>.
- * In JBoss AS there is little benefit to setting this to true, as the
- * single-threaded nature of deployments in the AS ensures that services
- * always connect channels and request state transfer in series, with no
- * interleaving.
- *
- * @param register_for_state_transfer ignored; always treated as <code>false</code>
*/
@Override
public Channel createMultiplexerChannel(String stack_name, String id, boolean register_for_state_transfer, String substate_id) throws Exception
@@ -93,8 +87,15 @@
}
/**
+ * {@inheritDoc}
+ *
* Overrides the superclass version by generating a unique node id
- * and passing it down the Channel as additional_data.
+ * and passing it down the Channel as additional_data and by suppressing the
+ * <code>register_for_state_transfer</code> param.
+ * <p/>
+ * The additional data is the value of {@link #getNodeName()} which either
+ * can be injected as part of configuration or will be calculated
+ * the first time a channel is created.
*/
@Override
public Channel createMultiplexerChannel(String stack_name, String id) throws Exception
Added: trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactoryMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactoryMBean.java (rev 0)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactoryMBean.java 2008-03-27 14:45:47 UTC (rev 71350)
@@ -0,0 +1,278 @@
+package org.jboss.ha.framework.server;
+
+import javax.management.ObjectName;
+
+import org.jgroups.Channel;
+import org.jgroups.ChannelException;
+
+/**
+ * StandardMBean interface for {@link JChannelFactory}. Based on the
+ * <code>org.jgroups.jmx.JChannelFactoryMBean</code> interface, which
+ * is scheduled to be removed.
+ * <p>
+ * The plain-old-java-interface for the channel factory is
+ * <code>org.jgroups.ChannelFactory</code>; users are encouraged to dependency
+ * inject the
+ *
+ *
+ * @author Bela Ban
+ * @author Brian Stansberry
+ *
+ * @version $Revision: 69425 $
+ */
+public interface JChannelFactoryMBean
+{
+ /**
+ * Returns all configurations as a string
+ */
+ String getMultiplexerConfig();
+
+ /**
+ * Instructs JGroups to load a set of XML protocol stack configurations.
+ * Same as {@link #setMultiplexerConfig(String, boolean) setMultiplexerConfig(properties, true)}.
+ *
+ * @param properties a string representing a system resource containing a
+ * JGroups XML configuration, a string representing a URL
+ * pointing to a JGroups XML configuration, or a string
+ * representing a file name that contains a JGroups XML
+ * configuration.
+ *
+ * @throws Exception
+ */
+ void setMultiplexerConfig(String properties) throws Exception;
+
+ /**
+ * Instructs JGroups to load a set of XML protocol stack configurations.
+ *
+ * @param properties a string representing a system resource containing a
+ * JGroups XML configuration, a string representing a URL
+ * pointing to a JGroups XML configuration, or a string
+ * representing a file name that contains a JGroups XML
+ * configuration.
+ * @param replace <code>true</code> if any protocol stack configuration
+ * in <code>properties</code> that has the same name
+ * as an existing configuration should replace that
+ * existing configuration; <code>false</code> if the
+ * existing configuration should take precedence.
+ *
+ * @throws Exception
+ */
+ void setMultiplexerConfig(String properties, boolean replace) throws Exception;
+
+ /**
+ * Gets the domain portion of any {@link ObjectName} the factory should
+ * use when registering channels or protocols in JMX.
+ *
+ * @return the domain portion of the object name, or <code>null</code>.
+ */
+ String getDomain();
+
+ /**
+ * Sets the domain portion of any {@link ObjectName} the factory should
+ * use when registering channels or protocols in JMX.
+ *
+ * @param name the domain portion of the object name. Must conform to
+ * the rules for elements in an ObjectName.
+ */
+ void setDomain(String name);
+
+ /**
+ * Gets whether this factory should register channels it creates in JMX.
+ *
+ * @return <code>true</code> if channels should be registered,
+ * <code>false</code> if not
+ */
+ boolean isExposeChannels();
+
+ /**
+ * Sets whether this factory should register channels it creates in JMX.
+ *
+ * @param flag <code>true</code> if channels should be registered,
+ * <code>false</code> if not
+ */
+ void setExposeChannels(boolean flag);
+
+ /**
+ * Gets whether this factory should register protocols it creates in JMX.
+ *
+ * @return <code>true</code> if protocols should be registered,
+ * <code>false</code> if not
+ */
+ boolean isExposeProtocols();
+
+ /**
+ * Sets whether this factory should register protocols it creates in JMX.
+ *
+ * @param flag <code>true</code> if protocols should be registered,
+ * <code>false</code> if not
+ */
+ void setExposeProtocols(boolean f);
+
+ /**
+ * Returns the stack configuration as a string (valid to be fed into new JChannel()). Throws an exception
+ * if the stack_name is not found. One of the setMultiplexerConfig() methods had to be called beforehand.
+ *
+ * @return The protocol stack config as a plain string
+ */
+ String getConfig(String stack_name) throws Exception;
+
+ /**
+ * Removes the given stack from the configuration.
+ *
+ * @param stack_name the name of the stack
+ * @return <code>true</code> if the stack was removed; <code>false</code> if
+ * it wasn't registered
+ */
+ boolean removeConfig(String stack_name);
+
+ /** Removes all protocol stack configurations */
+ void clearConfigurations();
+
+ /**
+ * Create a non-multiplexed {@link Channel} using the given stack.
+ *
+ * @param stack_name the name of the stack
+ * @return the channel
+ *
+ * @throws Exception
+ */
+ Channel createChannel(String stack_name) throws Exception;
+
+ /**
+ * Creates an implementation of the Channel using a given stack name and
+ * registering it under a given identity.
+ * <p>
+ * <emphasis>NOTE:</emphasis> The implementation of this method is somewhat
+ * different from what is described in
+ * {@link org.jgroups.ChannelFactory#createMultiplexerChannel(String, String)}.
+ * What type of channel is created depends on whether the specified protocol
+ * stack includes the <code>singleton_name</code> attribute in its
+ * {@link org.jgroups.protocols.TP transport protocol} configuration:
+ * <ul>
+ * <li>
+ * If <code>singleton_name</code> is not specified, a multiplexer-enabled
+ * channel will be returned. This will be an implementation of Channel which
+ * keeps track of the provided <code>id</code>, so that it can be attached
+ * to each message and be properly dispatched at the receiver.
+ * <p>
+ * In this case, the given <code>id</code> must be unique per stack name.
+ * An Exception will be thrown if an attempt to register a duplicate
+ * Channel per stack.
+ * </li>
+ * <li>
+ * If <code>singleton_name</code> is not specified, a non-multiplexer
+ * enabled channel that instead uses a shared transport will be returned.
+ * The <code>id</code> parameter will be ignored.
+ * </li>
+ * </ul>
+ *
+ * @param stack_name
+ * The name of the stack to be used. All stacks are defined in
+ * the configuration with which the factory is configured (see
+ * {@link #setMultiplexerConfig(Object)} for example. If
+ * clients attempt to create a Channel for an undefined stack
+ * name an Exception will be thrown.
+ * @param id The identifier used for multiplexing and demultiplexing
+ * (dispatching requests to one of possibly multiple receivers).
+ * Ignored if a shared transport channel is created.
+ * Note that id needs to be a string since it will be shipped
+ * with each message. Try to pick a short string, because this is
+ * shipped with every message (overhead).
+ *
+ * @return An implementation of Channel either configured to multiplex
+ * messages to different services or configured with a shared
+ * transport.
+ *
+ * @see Multiplexer
+ * @see MuxChannel
+ *
+ * @throws ChannelException
+ */
+ Channel createMultiplexerChannel(String stack_name, String id) throws Exception;
+
+
+ /**
+ * Creates an implementation of the Channel using a given stack name and
+ * registering it under a given identity.
+ * <p>
+ * <emphasis>NOTE:</emphasis> The implementation of this method is somewhat
+ * different from what is described in
+ * {@link org.jgroups.ChannelFactory#createMultiplexerChannel(String, String)}.
+ * See {@link #createMultiplexerChannel(String, String)} for details.
+ * <p>
+ * JBoss AS ignores the <code>register_for_state_transfer</code> param,
+ * treating it as <code>false</code>. Suppressing the
+ * <code>register_for_state_transfer</code> param is necessary
+ * to avoid issues that occur with JGroups when it is <code>true</code>.
+ * In JBoss AS there is little benefit to setting this to true, as the
+ * single-threaded nature of deployments in the AS ensures that services
+ * always connect channels and request state transfer in series, with no
+ * interleaving.
+ *
+ * @param stack_name
+ * The name of the stack to be used. All stacks are defined in
+ * the configuration with which the factory is configured (see
+ * {@link #setMultiplexerConfig(Object)} for example. If
+ * clients attempt to create a Channel for an undefined stack
+ * name an Exception will be thrown.
+ * @param id The identifier used for multiplexing and demultiplexing
+ * (dispatching requests to one of possibly multiple receivers).
+ * Ignored if a shared transport channel is created.
+ * Note that id needs to be a string since it will be shipped
+ * with each message. Try to pick a short string, because this is
+ * shipped with every message (overhead).
+ * @param register_for_state_transfer ignored in JBoss AS. Treated as <code>false</code>.
+ *
+ * @param substate_id ignored in JBoss AS
+ *
+ * @return An implementation of Channel either configured to multiplex
+ * messages to different services or configured with a shared
+ * transport.
+ *
+ * @see Multiplexer
+ * @see MuxChannel
+ *
+ * @throws ChannelException
+ */
+ Channel createMultiplexerChannel(String stack_name, String id, boolean register_for_state_transfer, String substate_id) throws Exception;
+
+ /**
+ * Execute the create phase of the 4 step lifecycle.
+ *
+ * @throws Exception
+ */
+ void create() throws Exception;
+
+ /**
+ * Execute the start phase of the 4 step lifecycle.
+ *
+ * @throws Exception
+ */
+ void start() throws Exception;
+
+ /**
+ * Execute the stop phase of the 4 step lifecycle.
+ *
+ * @throws Exception
+ */
+ void stop();
+
+ /**
+ * Execute the destroy phase of the 4 step lifecycle.
+ *
+ * @throws Exception
+ */
+ void destroy();
+
+ /**
+ * Returns the names of the currently registered protocol stack configurations.
+ */
+ String dumpConfiguration();
+
+ /**
+ * Dumps the names of any currently running multiplexer channels along with
+ * the id's of any services that are using them. Information about
+ * currently running non-multiplexer channels are not returned.
+ */
+ String dumpChannels();
+}
Modified: trunk/cluster/src/resources/jgroups/jgroups-channelfactory-beans.xml
===================================================================
--- trunk/cluster/src/resources/jgroups/jgroups-channelfactory-beans.xml 2008-03-27 14:45:41 UTC (rev 71349)
+++ trunk/cluster/src/resources/jgroups/jgroups-channelfactory-beans.xml 2008-03-27 14:45:47 UTC (rev 71350)
@@ -7,7 +7,7 @@
on any shared channel -->
<bean name="JChannelFactory" class="org.jboss.ha.framework.server.JChannelFactory">
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.jgroups:service=ChannelFactory", exposedInterface=org.jgroups.jmx.JChannelFactoryMBean.class, registerDirectly=false)</annotation>
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.jgroups:service=ChannelFactory", exposedInterface=org.jboss.ha.framework.server.JChannelFactoryMBean.class, registerDirectly=false)</annotation>
<property name="multiplexerConfig">META-INF/jgroups-channelfactory-stacks.xml</property>
More information about the jboss-cvs-commits
mailing list