[jboss-cvs] JBoss Messaging SVN: r2770 - in trunk: tests/src/org/jboss/test/messaging/tools/jmx and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jun 11 08:10:15 EDT 2007
Author: sergeypk
Date: 2007-06-11 08:10:15 -0400 (Mon, 11 Jun 2007)
New Revision: 2770
Modified:
trunk/src/etc/server/default/deploy/remoting-service.xml
trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
Log:
http://jira.jboss.com/jira/browse/JBMESSAGING-861 - use configuration in remoting-service.xml. Not implemented yet for the http invoker (see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=110533).
Modified: trunk/src/etc/server/default/deploy/remoting-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/remoting-service.xml 2007-06-08 12:58:49 UTC (rev 2769)
+++ trunk/src/etc/server/default/deploy/remoting-service.xml 2007-06-11 12:10:15 UTC (rev 2770)
@@ -26,7 +26,7 @@
<attribute name="serverBindPort">4457</attribute>
<attribute name="leasePeriod">10000</attribute>
<attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
- <attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
+ <attribute name="serverSocketClass" isParam="true">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
<attribute name="numberOfRetries" isParam="true">1</attribute>
<attribute name="numberOfCallRetries" isParam="true">1</attribute>
<attribute name="clientMaxPoolSize" isParam="true">50</attribute>
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2007-06-08 12:58:49 UTC (rev 2769)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2007-06-11 12:10:15 UTC (rev 2770)
@@ -33,6 +33,7 @@
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -89,6 +90,9 @@
import org.jboss.tm.TransactionManagerService;
import org.jboss.tm.TxManager;
import org.jboss.tm.usertx.client.ServerVMClientUserTransaction;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
import com.arjuna.ats.arjuna.recovery.RecoveryManager;
@@ -1310,7 +1314,95 @@
{
stopService(managedConnFactoryObjectName);
}
+
+ private String buildLocatorURI(String transport, Map overrideMap) throws Exception
+ {
+ // We use this from thirdparty remoting tests when we don't want to send stuff through
+ // JMSWireFormat, but we want everything else in the connector's configuration to be
+ // identical with what we use in Messaging
+ boolean overrideMarshallers =
+ overrideMap != null && overrideMap.get(DO_NOT_USE_MESSAGING_MARSHALLERS) != null;
+ // Note that we DO NOT want the direct thread pool on the server side - since that can lead
+ // to deadlocks
+
+ String params;
+
+ // specific parameters per transport
+ if ("http".equals(transport))
+ {
+ // TODO - use remoting-service.xml parameters, not these ...
+
+ long clientLeasePeriod = 20000;
+
+ String marshallers = overrideMarshallers ? "" :
+ "marshaller=org.jboss.jms.wireformat.JMSWireFormat&" +
+ "unmarshaller=org.jboss.jms.wireformat.JMSWireFormat&";
+
+ params =
+ "/?" +
+ marshallers +
+ "socket.check_connection=false&" +
+ "clientLeasePeriod=" + clientLeasePeriod +
+ "&dataType=jms";
+
+ params += "&callbackPollPeriod=" + HTTP_CONNECTOR_CALLBACK_POLL_PERIOD +
+ "&callbackStore=org.jboss.remoting.callback.BlockingCallbackStore";
+ }
+ else
+ {
+ //socket transports
+ MBeanConfigurationElement connectorServiceConfig =
+ ServiceConfigHelper.loadServiceConfiguration("server/default/deploy/remoting-service.xml", "Connector");
+
+ String invokerConfig = connectorServiceConfig.getAttributeValue("Configuration");
+
+ Element invokerConfigRoot = XMLUtil.stringToElement(invokerConfig);
+ Element invokerElement = (Element) invokerConfigRoot.getElementsByTagName("invoker").item(0);
+
+ NodeList invokerAttributes = invokerElement.getElementsByTagName("attribute");
+
+ StringBuffer paramsBuffer = new StringBuffer();
+
+ for (int i = 0; i < invokerAttributes.getLength(); i++)
+ {
+ Element attr = (Element) invokerAttributes.item(i);
+ if (attr.getAttribute("isParam").equals(""))
+ {
+ continue;
+ }
+
+ String key = attr.getAttribute("name");
+ String value = attr.getTextContent().trim();
+
+ if (overrideMarshallers &&
+ (key.equals("marshaller") || key.equals("unmarshaller")))
+ {
+ continue;
+ }
+
+ if (paramsBuffer.length() > 0)
+ {
+ paramsBuffer.append('&');
+ }
+
+ paramsBuffer.append(key).append('=').append(value);
+ }
+
+ params = paramsBuffer.insert(0, "/?").toString();
+ }
+
+ if ("sslbisocket".equals(transport) || "sslsocket".equals(transport))
+ {
+ System.setProperty("javax.net.ssl.keyStorePassword", "secureexample");
+ String keyStoreFilePath = this.getClass().getResource("../../../../../../../etc/messaging.keystore").getFile();
+ System.setProperty("javax.net.ssl.keyStore", keyStoreFilePath);
+ }
+
+ int freePort = PortUtil.findFreePort(ipAddressOrHostName);
+ return transport + "://" + ipAddressOrHostName + ":" + freePort + params;
+ }
+
private void startRemoting(ServiceAttributeOverrides attrOverrides,
String transport,
ObjectName objectName) throws Exception
@@ -1335,62 +1427,10 @@
if (locatorURI == null)
{
- // TODO - use remoting-service.xml parameters, not these ...
-
- long clientLeasePeriod = 20000;
-
- String marshallers =
- "marshaller=org.jboss.jms.wireformat.JMSWireFormat&" +
- "unmarshaller=org.jboss.jms.wireformat.JMSWireFormat&";
-
- // We use this from thirdparty remoting tests when we don't want to send stuff through
- // JMSWireFormat, but we want everything else in the connector's configuration to be
- // identical with what we use in Messaging
- if (overrideMap != null && overrideMap.get(DO_NOT_USE_MESSAGING_MARSHALLERS) != null)
- {
- marshallers = "";
- }
-
- // Note that we DO NOT want the direct thread pool on the server side - since that can lead
- // to deadlocks
-
- String params =
- "/?" +
- marshallers +
- "socket.check_connection=false&" +
- "clientLeasePeriod=" + clientLeasePeriod +
- "&dataType=jms";
-
- // specific parameters per transport
-
- if ("http".equals(transport))
- {
- params += "&callbackPollPeriod=" + HTTP_CONNECTOR_CALLBACK_POLL_PERIOD +
- "&callbackStore=org.jboss.remoting.callback.BlockingCallbackStore";
- }
- else
- {
- //socket transports
- params += "&timeout=0&" +
- "clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&" +
- "serverSocketClass=org.jboss.jms.server.remoting.ServerSocketWrapper&" +
- "NumberOfRetries=1&" +
- "NumberOfCallRetries=1";
- }
-
- if ("sslbisocket".equals(transport) || "sslsocket".equals(transport))
- {
- System.setProperty("javax.net.ssl.keyStorePassword", "secureexample");
- String keyStoreFilePath = this.getClass().getResource("../../../../../../../etc/messaging.keystore").getFile();
- System.setProperty("javax.net.ssl.keyStore", keyStoreFilePath);
- }
-
- int freePort = PortUtil.findFreePort(ipAddressOrHostName);
- locatorURI = transport + "://" + ipAddressOrHostName + ":" + freePort + params;
+ locatorURI = buildLocatorURI(transport, overrideMap);
log.info("creating server for: " + locatorURI);
}
-
log.debug("Using locator uri: " + locatorURI);
InvokerLocator locator = new InvokerLocator(locatorURI);
More information about the jboss-cvs-commits
mailing list