[jboss-cvs] JBoss Messaging SVN: r2324 - in trunk: src/etc/server/default/deploy and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Feb 15 08:42:04 EST 2007
Author: timfox
Date: 2007-02-15 08:42:04 -0500 (Thu, 15 Feb 2007)
New Revision: 2324
Modified:
trunk/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml
trunk/src/etc/server/default/deploy/remoting-service.xml
trunk/src/main/org/jboss/jms/client/remoting/ClientSocketWrapper.java
trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
trunk/src/main/org/jboss/jms/server/remoting/ServerSocketWrapper.java
trunk/tests/build.xml
trunk/tests/etc/container.xml
trunk/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
trunk/tests/src/org/jboss/test/thirdparty/remoting/CallbackServerTimeoutTest.java
trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingConnectionFailureTest.java
Log:
Merge Branch_BisocketExperiment2 into TRUNK
http://jira.jboss.org/jira/browse/JBMESSAGING-694
Modified: trunk/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml
===================================================================
--- trunk/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml 2007-02-15 10:25:06 UTC (rev 2323)
+++ trunk/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml 2007-02-15 13:42:04 UTC (rev 2324)
@@ -18,7 +18,7 @@
display-name="SSL Socket Transport Connector">
<attribute name="Configuration">
<config>
- <invoker transport="sslsocket">
+ <invoker transport="sslbisocket">
<attribute name="marshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
<attribute name="unmarshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
<attribute name="serializationtype" isParam="true">jms</attribute>
Modified: trunk/src/etc/server/default/deploy/remoting-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/remoting-service.xml 2007-02-15 10:25:06 UTC (rev 2323)
+++ trunk/src/etc/server/default/deploy/remoting-service.xml 2007-02-15 13:42:04 UTC (rev 2324)
@@ -13,7 +13,7 @@
display-name="Socket transport Connector">
<attribute name="Configuration">
<config>
- <invoker transport="socket">
+ <invoker transport="bisocket">
<attribute name="marshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
<attribute name="unmarshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
<!-- Serialization type must be jms - do not change! -->
Modified: trunk/src/main/org/jboss/jms/client/remoting/ClientSocketWrapper.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/ClientSocketWrapper.java 2007-02-15 10:25:06 UTC (rev 2323)
+++ trunk/src/main/org/jboss/jms/client/remoting/ClientSocketWrapper.java 2007-02-15 13:42:04 UTC (rev 2324)
@@ -33,6 +33,8 @@
import java.net.Socket;
import java.util.Map;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.transport.socket.OpenConnectionChecker;
import org.jboss.remoting.transport.socket.SocketWrapper;
/**
@@ -41,9 +43,11 @@
*
* $Id$
*/
-public class ClientSocketWrapper extends SocketWrapper
+public class ClientSocketWrapper extends SocketWrapper implements OpenConnectionChecker
{
// Constants ------------------------------------------------------------------------------------
+ final static private Logger log = Logger.getLogger(ClientSocketWrapper.class);
+ final static protected int CLOSING = 1;
// Static ---------------------------------------------------------------------------------------
@@ -87,7 +91,17 @@
out.flush();
in.readByte();
}
+ // OpenConnectionChecker implementation ---------------------------------------------------------
+ public void checkOpenConnection() throws IOException
+ {
+ if (in.available() > 0)
+ {
+ log.trace("remote endpoint has closed");
+ throw new IOException("remote endpoint has closed");
+ }
+ }
+
// Public ---------------------------------------------------------------------------------------
public String toString()
Modified: trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2007-02-15 10:25:06 UTC (rev 2323)
+++ trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2007-02-15 13:42:04 UTC (rev 2324)
@@ -32,8 +32,10 @@
import org.jboss.remoting.ServerInvoker;
import org.jboss.remoting.callback.CallbackPoller;
import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.bisocket.Bisocket;
import org.jboss.remoting.transport.socket.MicroSocketClientInvoker;
import org.jboss.remoting.transport.socket.SocketServerInvoker;
+import org.jboss.util.id.GUID;
/**
@@ -119,6 +121,16 @@
{
metadata.put(Client.CALLBACK_SERVER_PORT, propertyPort);
}
+
+ String protocol = serverLocator.getProtocol();
+ if ("bisocket".equals(protocol) || "sslbisocket".equals(protocol))
+ {
+ metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+ // Setting the port prevents the Remoting Client from using PortUtil.findPort(),
+ // which creates ServerSockets. The actual value of the port shouldn't matter.
+ if (propertyPort == null)
+ metadata.put(Client.CALLBACK_SERVER_PORT, Integer.toString(new GUID().hashCode()));
+ }
}
else
{
@@ -166,9 +178,12 @@
throws Throwable
{
- // For socket transport allow true push callbacks, with callback Connector.
- // For http transport, simulate push callbacks.
- boolean doPushCallbacks = "socket".equals(serverLocator.getProtocol());
+ // For transports derived from the socket transport, allow true push callbacks,
+ // with callback Connector. For http transport, simulate push callbacks.
+ String protocol = serverLocator.getProtocol();
+ boolean isBisocket = "bisocket".equals(protocol) || "sslbisocket".equals(protocol);
+ boolean isSocket = "socket".equals(protocol) || "sslsocket".equals(protocol);
+ boolean doPushCallbacks = isBisocket || isSocket;
Map metadata = createCallbackMetadata(doPushCallbacks, initialMetadata, serverLocator);
if (doPushCallbacks)
Modified: trunk/src/main/org/jboss/jms/server/remoting/ServerSocketWrapper.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/remoting/ServerSocketWrapper.java 2007-02-15 10:25:06 UTC (rev 2323)
+++ trunk/src/main/org/jboss/jms/server/remoting/ServerSocketWrapper.java 2007-02-15 13:42:04 UTC (rev 2324)
@@ -61,7 +61,27 @@
{
super(socket, metadata, timeout);
}
+
+ // SocketWrapper overrides ----------------------------------------------------------------------
+ public void close() throws IOException
+ {
+ if(getSocket() != null)
+ {
+ try
+ {
+ getOutputStream().write(CLOSING);
+ getOutputStream().flush();
+ log.debug("wrote CLOSING byte");
+ }
+ catch (IOException e)
+ {
+ log.debug("cannot write CLOSING byte", e);
+ }
+ super.close();
+ }
+ }
+
// Public --------------------------------------------------------
public void checkConnection() throws IOException
Modified: trunk/tests/build.xml
===================================================================
--- trunk/tests/build.xml 2007-02-15 10:25:06 UTC (rev 2323)
+++ trunk/tests/build.xml 2007-02-15 13:42:04 UTC (rev 2324)
@@ -74,7 +74,7 @@
<!--
Default remoting configuration (must be overrided by tasks that need it set otherwise).
-->
- <property name="test.remoting" value="socket"/>
+ <property name="test.remoting" value="bisocket"/>
<!--
@@ -363,7 +363,7 @@
<antcall target="crash-tests"/>
<antcall target="invm-tests"/>
<!--
- default remoting configuration (socket)
+ default remoting configuration (bisocket)
-->
<antcall target="remote-tests"/>
<antcall target="remote-tests">
@@ -381,7 +381,7 @@
<target name="stress-tests" depends="tests-jar, prepare-testdirs, clear-test-logs">
<antcall target="invm-stress-tests"/>
- <antcall target="remote-stress-tests"/> <!-- default remoting configuration (socket) -->
+ <antcall target="remote-stress-tests"/> <!-- default remoting configuration (bisocket) -->
<antcall target="remote-stress-tests">
<param name="test.remoting" value="http"/>
</antcall>
@@ -962,7 +962,7 @@
<antcall target="stop-rmi-server"/>
<!--
- ClientCrashTest over "socket"
+ ClientCrashTest over "bisocket"
-->
<antcall target="start-rmi-server">
@@ -988,7 +988,7 @@
</antcall>
<!--
- ClientCrashTwoConnectionsTest over "socket"
+ ClientCrashTwoConnectionsTest over "bisocket"
-->
<antcall target="start-rmi-server">
@@ -1014,7 +1014,7 @@
</antcall>
<!--
- ClientCrashNegativeLeaseTest over "socket"
+ ClientCrashNegativeLeaseTest over "bisocket"
-->
<antcall target="start-rmi-server">
@@ -1041,7 +1041,7 @@
</antcall>
<!--
- ClientCrashZeroLeaseTest over "socket"
+ ClientCrashZeroLeaseTest over "bisocket"
-->
<antcall target="start-rmi-server">
@@ -1068,7 +1068,7 @@
</antcall>
<!--
- ClientCrashLargeLeaseTest over "socket"
+ ClientCrashLargeLeaseTest over "bisocket"
-->
<antcall target="start-rmi-server">
@@ -1095,7 +1095,7 @@
</antcall>
<!--
- CallbackFailureTest over "socket"
+ CallbackFailureTest over "bisocket"
-->
<antcall target="start-rmi-server">
Modified: trunk/tests/etc/container.xml
===================================================================
--- trunk/tests/etc/container.xml 2007-02-15 10:25:06 UTC (rev 2323)
+++ trunk/tests/etc/container.xml 2007-02-15 13:42:04 UTC (rev 2324)
@@ -77,9 +77,9 @@
<serialization-type>jms</serialization-type>
<!--
- Supported values: "socket", "http"
+ Supported values: "bisocket", "sslbisocket", "socket", "sslsocket", "http"
-->
- <remoting-transport>socket</remoting-transport>
+ <remoting-transport>bisocket</remoting-transport>
<!--
Specifies whether to start a clustered messaging server or not. If "test.clustered" is set,
Modified: trunk/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java 2007-02-15 10:25:06 UTC (rev 2323)
+++ trunk/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java 2007-02-15 13:42:04 UTC (rev 2324)
@@ -152,12 +152,17 @@
try
{
+ String address = InetAddress.getLocalHost().getHostAddress();
+ System.setProperty("jboss.messaging.callback.bind.address", address);
+
int freePort = PortUtil.findFreePort(InetAddress.getLocalHost().getHostName());
System.setProperty("jboss.messaging.callback.bind.port", Integer.toString(freePort));
String pollPeriod = "654";
System.setProperty("jboss.messaging.callback.pollPeriod", pollPeriod);
+ System.setProperty("jboss.messaging.callback.reportPollingStatistics", "true");
+
connection = (JBossConnection)cf.createConnection();
connection.start();
@@ -170,7 +175,10 @@
InvokerLocator locator = (InvokerLocator)field.get(remotingConnection);
String transport = locator.getProtocol();
- if ("socket".equals(transport))
+ if ("socket".equals(transport)
+ || "sslsocket".equals(transport)
+ || "bisocket".equals(transport)
+ || "sslbisocket".equals(transport))
{
field = Client.class.getDeclaredField("callbackConnectors");
field.setAccessible(true);
@@ -179,6 +187,7 @@
InvokerCallbackHandler callbackHandler = remotingConnection.getCallbackManager();
Connector connector = (Connector)callbackConnectors.get(callbackHandler);
locator = new InvokerLocator(connector.getInvokerLocator());
+ assertEquals(address, locator.getHost());
assertEquals(freePort, locator.getPort());
}
else if ("http".equals(transport))
@@ -195,6 +204,10 @@
field.setAccessible(true);
assertEquals(pollPeriod, ((Long)field.get(callbackPoller)).toString());
+
+ field = CallbackPoller.class.getDeclaredField("reportStatistics");
+ field.setAccessible(true);
+ assertEquals(true, ((Boolean) field.get(callbackPoller)).booleanValue());
}
else
{
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2007-02-15 10:25:06 UTC (rev 2323)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2007-02-15 13:42:04 UTC (rev 2324)
@@ -1398,9 +1398,17 @@
{
params += "&timeout=0";
}
-
+
+ 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;
+ log.info("creating server for: " + locatorURI);
}
Modified: trunk/tests/src/org/jboss/test/thirdparty/remoting/CallbackServerTimeoutTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/thirdparty/remoting/CallbackServerTimeoutTest.java 2007-02-15 10:25:06 UTC (rev 2323)
+++ trunk/tests/src/org/jboss/test/thirdparty/remoting/CallbackServerTimeoutTest.java 2007-02-15 13:42:04 UTC (rev 2324)
@@ -113,6 +113,11 @@
{
if (client != null)
{
+ // Note. Calling Client.disconnect() does remove the InvokerCallbackHandler
+ // registered above. For the http transport, the CallbackPoller will continue
+ // running, which will generate a lot of ERROR log messages after the server
+ // has shut down.
+ client.removeListener(callbackHandler);
client.disconnect();
}
Modified: trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingConnectionFailureTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingConnectionFailureTest.java 2007-02-15 10:25:06 UTC (rev 2323)
+++ trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingConnectionFailureTest.java 2007-02-15 13:42:04 UTC (rev 2324)
@@ -116,6 +116,14 @@
// if the client throws CannotConnectException, we're fine, this is our
// FailoverValveInteceptor is looking after
}
+ catch(IOException e)
+ {
+ // This happens for bisocket clients - if the client throws IOException subclass, we're fine,
+ // this is what our FailoverValveInteceptor is looking after
+
+ // Note. The bisocket transport can make internal invocations and therefore have a
+ // pooled connectin available.
+ }
}
public void testInvocationAfterDeathDetectedByPinger() throws Throwable
More information about the jboss-cvs-commits
mailing list