[jboss-cvs] JBoss Messaging SVN: r3201 - in trunk/src: etc/server/default/deploy and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 19 06:39:50 EDT 2007
Author: timfox
Date: 2007-10-19 06:39:50 -0400 (Fri, 19 Oct 2007)
New Revision: 3201
Modified:
trunk/src/etc/remoting/remoting-bisocket-service.xml
trunk/src/etc/remoting/remoting-sslbisocket-service.xml
trunk/src/etc/server/default/deploy/connection-factories-service.xml
trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml
trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
Log:
Various sanity checks
Modified: trunk/src/etc/remoting/remoting-bisocket-service.xml
===================================================================
--- trunk/src/etc/remoting/remoting-bisocket-service.xml 2007-10-19 08:46:07 UTC (rev 3200)
+++ trunk/src/etc/remoting/remoting-bisocket-service.xml 2007-10-19 10:39:50 UTC (rev 3201)
@@ -43,6 +43,12 @@
<!-- Max Number of connections in client pool. This should be significantly higher than
the max number of sessions/consumers you expect -->
<attribute name="clientMaxPoolSize" isParam="true">200</attribute>
+
+ <!-- Use these parameters to specify values for binding and connecting control connections to
+ work with your firewall/NAT configuration
+ <attribute name="secondaryBindPort">xyz</attribute>
+ <attribute name="secondaryConnectPort">abc</attribute>
+ -->
</invoker>
<handlers>
Modified: trunk/src/etc/remoting/remoting-sslbisocket-service.xml
===================================================================
--- trunk/src/etc/remoting/remoting-sslbisocket-service.xml 2007-10-19 08:46:07 UTC (rev 3200)
+++ trunk/src/etc/remoting/remoting-sslbisocket-service.xml 2007-10-19 10:39:50 UTC (rev 3201)
@@ -43,6 +43,12 @@
the max number of sessions/consumers you expect -->
<attribute name="clientMaxPoolSize" isParam="true">200</attribute>
+ <!-- Use these parameters to specify values for binding and connecting control connections to
+ work with your firewall/NAT configuration
+ <attribute name="secondaryBindPort">xyz</attribute>
+ <attribute name="secondaryConnectPort">abc</attribute>
+ -->
+
</invoker>
<handlers>
<handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
Modified: trunk/src/etc/server/default/deploy/connection-factories-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/connection-factories-service.xml 2007-10-19 08:46:07 UTC (rev 3200)
+++ trunk/src/etc/server/default/deploy/connection-factories-service.xml 2007-10-19 10:39:50 UTC (rev 3201)
@@ -119,6 +119,10 @@
<!- - Whether we should be strict TCK compliant, i.e. how we deal with foreign messages, defaults to false- ->
<attribute name="StrictTck">true</attribute>
+
+ <!- - Disable JBoss Remoting Connector sanity checks - There is rarely a good reason to set this to true - ->
+
+ <attribute name="DisableRemotingChecks">false</attribute>
<!- - The connection factory will be bound in the following places in JNDI - ->
Modified: trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml
===================================================================
--- trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml 2007-10-19 08:46:07 UTC (rev 3200)
+++ trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml 2007-10-19 10:39:50 UTC (rev 3201)
@@ -112,11 +112,17 @@
<type>java.lang.String</type>
</attribute>
- <attribute access="read-write" getMethod="isStrictTck" setMethod="setStrictTck">
+ <attribute access="read-write" getMethod="isStrictTck" setMethod="setStrictTck">
<description>Does this CF support StrictTCK</description>
<name>StrictTck</name>
<type>boolean</type>
</attribute>
+
+ <attribute access="read-write" getMethod="isDisableRemotingChecks" setMethod="setDisableRemotingChecks">
+ <description>Disable remoting connector parameter sanity checks. There is rarely a good reason to set this to true</description>
+ <name>DisableRemotingChecks</name>
+ <type>boolean</type>
+ </attribute>
<!-- Managed operations -->
Modified: trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java 2007-10-19 08:46:07 UTC (rev 3200)
+++ trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java 2007-10-19 10:39:50 UTC (rev 3201)
@@ -78,6 +78,8 @@
private boolean started;
private boolean strictTck;
+
+ private boolean disableRemotingChecks;
// Constructors ---------------------------------------------------------------------------------
@@ -160,19 +162,62 @@
InvokerLocator locator = new InvokerLocator(locatorURI);
- //Sanity check - If users are using the AS Service Binding Manager to provide the remoting connector
- //configuration, it is quite easy for them to end up using an old version depending on what version on
- //the AS they are running in - e.g. if they have forgotten to update it.
- //This can lead to subtle errors - therefore we do a sanity check by checking the existence of some properties
- //which should always be there
- Map params = locator.getParameters();
+ String protocol = locator.getProtocol();
- Iterator iter= params.entrySet().iterator();
- log.info("Remoting connector params:");
- while (iter.hasNext())
- {
- Map.Entry entry = (Map.Entry)iter.next();
- log.info(entry.getKey() + "-->" + entry.getValue());
+ if (!disableRemotingChecks && (protocol.equals("bisocket") || protocol.equals("sslbisocket")))
+ {
+ //Sanity check - If users are using the AS Service Binding Manager to provide the remoting connector
+ //configuration, it is quite easy for them to end up using an old version depending on what version on
+ //the AS they are running in - e.g. if they have forgotten to update it.
+ //This can lead to subtle errors - therefore we do a sanity check by checking the existence of some properties
+ //which should always be there
+ Map params = locator.getParameters();
+
+ Iterator iter= params.entrySet().iterator();
+ log.info("Remoting connector params:");
+ while (iter.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)iter.next();
+ log.info(entry.getKey() + "-->" + entry.getValue());
+ }
+
+ //The "compulsory" parameters
+ boolean cont =
+ checkParam(params, "marshaller", "org.jboss.jms.wireformat.JMSWireFormat") &&
+ checkParam(params, "unmarshaller", "org.jboss.jms.wireformat.JMSWireFormat") &&
+ checkParam(params, "dataType", "jms") &&
+ checkParam(params, "timeout", "0") &&
+ checkParam(params, "clientSocketClass", "org.jboss.jms.client.remoting.ClientSocketWrapper") &&
+ checkParam(params, "serverSocketClass", "org.jboss.jms.server.remoting.ServerSocketWrapper") &&
+ checkParam(params, "numberOfCallRetries", "1") &&
+ checkParam(params, "pingFrequency", "214748364") &&
+ checkParam(params, "pingWindowFactor", "10") &&
+ checkParam(params, "onewayThreadPool", "org.jboss.jms.server.remoting.DirectThreadPool");
+
+ if (!cont)
+ {
+ return;
+ }
+
+ String val = (String)params.get("clientLeasePeriod");
+ if (val != null)
+ {
+ int i = Integer.parseInt(val);
+ if (i < 5000)
+ {
+ log.warn("Value of clientLeasePeriod at " + i + " seems low. Normal values are >= 5000");
+ }
+ }
+
+ val = (String)params.get("clientMaxPoolSize");
+ if (val != null)
+ {
+ int i = Integer.parseInt(val);
+ if (i < 50)
+ {
+ log.warn("Value of clientMaxPoolSize at " + i + " seems low. Normal values are >= 50");
+ }
+ }
}
String info = "Connector " + locator.getProtocol() + "://" +
@@ -195,7 +240,7 @@
throw ExceptionUtil.handleJMXInvocation(t, this + " startService");
}
}
-
+
public synchronized void stopService() throws Exception
{
try
@@ -375,26 +420,48 @@
log.warn("DupsOKBatchSize can only be changed when connection factory is stopped");
return;
}
-
+
this.dupsOKBatchSize = size;
}
-
+
public int getDupsOKBatchSize()
{
- return this.dupsOKBatchSize;
+ return dupsOKBatchSize;
}
- public boolean isStrictTck()
- {
- return strictTck;
- }
+ public boolean isStrictTck()
+ {
+ return strictTck;
+ }
- public void setStrictTck(boolean strictTck)
- {
- this.strictTck = strictTck;
- }
+ public void setStrictTck(boolean strictTck)
+ {
+ if (started)
+ {
+ log.warn("StrictTCK can only be changed when connection factory is stopped");
+ return;
+ }
+
+ this.strictTck = strictTck;
+ }
+
+ public boolean isDisableRemotingChecks()
+ {
+ return disableRemotingChecks;
+ }
+
+ public void setDisableRemotingChecks(boolean disable)
+ {
+ if (started)
+ {
+ log.warn("DisableRemotingChecks can only be changed when connection factory is stopped");
+ return;
+ }
+
+ this.disableRemotingChecks = disable;
+ }
- // JMX managed operations -----------------------------------------------------------------------
+ // JMX managed operations -----------------------------------------------------------------------
// Public ---------------------------------------------------------------------------------------
@@ -404,5 +471,30 @@
// Private --------------------------------------------------------------------------------------
+ private boolean checkParam(Map params, String key, String value)
+ {
+ String val = (String)params.get(key);
+ if (val == null)
+ {
+ log.error("Parameter " + key + " is not specified in the remoting congiguration");
+ return false;
+ }
+ else if (!val.equals(value))
+ {
+ log.error("Parameter " + key + " has a different value ( " + val + ") to the default shipped with this version of " +
+ "JBM (" + value + "). " +
+ "There is rarely a valid reason to change this parameter value. " +
+ "If you are using ServiceBindingManager to supply the remoting configuration you should check " +
+ "that the parameter value specified there exactly matches the value in the configuration supplied with JBM. " +
+ "This connection factory will now not deploy. To override these checks set 'disableRemotingChecks' to " +
+ "true on the connection factory. Only do this if you are absolutely sure you know the consequences.");
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
// Inner classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java 2007-10-19 08:46:07 UTC (rev 3200)
+++ trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java 2007-10-19 10:39:50 UTC (rev 3201)
@@ -53,6 +53,7 @@
import org.jboss.messaging.core.contract.Replicator;
import org.jboss.messaging.util.JNDIUtil;
import org.jboss.messaging.util.Version;
+import org.jboss.remoting.InvokerLocator;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -117,8 +118,7 @@
boolean strictTck)
throws Exception
{
- log.debug(this + " registering connection factory '" + uniqueName +
- "', bindings: " + jndiBindings);
+ log.debug(this + " registering connection factory '" + uniqueName + "', bindings: " + jndiBindings);
// Sanity check
if (delegates.containsKey(uniqueName))
@@ -128,7 +128,6 @@
}
// See http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076040#4076040
- //String id = GUIDGenerator.generateGUID();
String id = uniqueName;
Version version = serverPeer.getVersion();
@@ -191,6 +190,15 @@
}
Map localDelegates = replicator.get(Replicator.CF_PREFIX + uniqueName);
+ boolean ok = sanityCheckFactories(localDelegates.values());
+ if (!ok)
+ {
+ final String msg = "The remoting locator configuration for a particular clustered connection factory must " +
+ "be the same on each node in the cluster. We have detected that the configuration differs on this " +
+ "node. Please correct and redeploy the connection factory";
+ log.error(msg);
+ throw new IllegalArgumentException(msg);
+ }
delegate = createClusteredDelegate(uniqueName, localDelegates.values(), loadBalancingFactory, endpoint, supportsFailover);
log.debug(this + " created clustered delegate " + delegate);
@@ -224,7 +232,7 @@
if (replicator != null) replicator.put(Replicator.CF_PREFIX + uniqueName, localDelegate);
}
-
+
public synchronized void unregisterConnectionFactory(String uniqueName, boolean supportsFailover, boolean supportsLoadBalancing)
throws Exception
{
@@ -478,6 +486,57 @@
return localDels;
}
+
+ private boolean sanityCheckFactories(Collection factories) throws Exception
+ {
+ Iterator iter = factories.iterator();
+ InvokerLocator prevLocator = null;
+ while (iter.hasNext())
+ {
+ ClientConnectionFactoryDelegate fact = (ClientConnectionFactoryDelegate)iter.next();
+
+ //Sanity check - the locator protocol and params MUST be the same on each node
+ String locatorString = fact.getServerLocatorURI();
+
+ InvokerLocator locator = new InvokerLocator(locatorString);
+
+ if (prevLocator != null)
+ {
+ //Do checks
+
+ if (!locator.getProtocol().equals(prevLocator.getProtocol()))
+ {
+ log.error("Protocol to be used for connection factory does not match protocol specified at other nodes in the cluster " +
+ locator.getProtocol() + ", " + prevLocator.getProtocol());
+ return false;
+ }
+ Map prevParams = prevLocator.getParameters();
+ Map params = locator.getParameters();
+ if (prevParams.size() != params.size())
+ {
+ log.error("Locator for connection factory has different number of parameters");
+ return false;
+ }
+ Iterator iter2 = prevParams.entrySet().iterator();
+ while (iter2.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)iter2.next();
+
+ String prevKey = (String)entry.getKey();
+ String prevValue = (String)entry.getValue();
+ String value = (String)params.get(prevKey);
+ if (value == null || !prevValue.equals(value))
+ {
+ log.error("Locator param does not exist or has wrong value");
+ return false;
+ }
+ }
+ }
+
+ prevLocator = locator;
+ }
+ return true;
+ }
// Inner classes --------------------------------------------------------------------------------
}
More information about the jboss-cvs-commits
mailing list