JBoss Remoting SVN: r4118 - remoting2/branches/2.x/src/etc.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-05-01 23:31:16 -0400 (Thu, 01 May 2008)
New Revision: 4118
Modified:
remoting2/branches/2.x/src/etc/build.xml
Log:
JBREM-773: Added targets to run bisocket example.
Modified: remoting2/branches/2.x/src/etc/build.xml
===================================================================
--- remoting2/branches/2.x/src/etc/build.xml 2008-05-02 03:16:37 UTC (rev 4117)
+++ remoting2/branches/2.x/src/etc/build.xml 2008-05-02 03:31:16 UTC (rev 4118)
@@ -257,6 +257,24 @@
</java>
</target>
+ <target name="run-bisocket-client" depends="compile-sample-classes">
+ <java classname="org.jboss.remoting.samples.bisocket.BisocketSampleClient">
+ <classpath>
+ <pathelement location="${examples.root}"/>
+ <path refid="library.classpath"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-bisocket-server" depends="compile-sample-classes">
+ <java classname="org.jboss.remoting.samples.bisocket.BisocketSampleServer">
+ <classpath>
+ <pathelement location="${examples.root}"/>
+ <path refid="library.classpath"/>
+ </classpath>
+ </java>
+ </target>
+
<!-- check to see if running jdk1.5 -->
<target name="get-jvm">
<condition property="isJDK5">
16 years, 8 months
JBoss Remoting SVN: r4117 - in remoting2/branches/2.x/src/main/org/jboss/remoting/samples: bisocket and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-05-01 23:16:37 -0400 (Thu, 01 May 2008)
New Revision: 4117
Added:
remoting2/branches/2.x/src/main/org/jboss/remoting/samples/bisocket/
remoting2/branches/2.x/src/main/org/jboss/remoting/samples/bisocket/BisocketSampleClient.java
remoting2/branches/2.x/src/main/org/jboss/remoting/samples/bisocket/BisocketSampleServer.java
Log:
JBREM-773: New bisocket example.
Added: remoting2/branches/2.x/src/main/org/jboss/remoting/samples/bisocket/BisocketSampleClient.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/samples/bisocket/BisocketSampleClient.java (rev 0)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/samples/bisocket/BisocketSampleClient.java 2008-05-02 03:16:37 UTC (rev 4117)
@@ -0,0 +1,161 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.remoting.samples.bisocket;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.bisocket.Bisocket;
+import org.jboss.remoting.transport.bisocket.BisocketServerInvoker;
+import org.jboss.remoting.transport.socket.SocketServerInvoker;
+
+
+/**
+ * This class and org.jboss.remoting.samples.bisocket.BisocketSampleServer
+ * demonstrate how to how to make an invocation and how to set up push callbacks
+ * over the bisocket transport.
+ *
+ * The reason for the existance of the bisocket transport, which is derived from the
+ * socket transport, is to make it possible to do push callbacks to a client which
+ * is unable to create a ServerSocket, either due to security restrictions or due
+ * to the fact that it is behind a firewall.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 1, 2008
+ * </p>
+ */
+public class BisocketSampleClient
+{
+ private static Logger log = Logger.getLogger(BisocketSampleClient.class);
+
+
+ public void makeInvocation(String locatorURI) throws Throwable
+ {
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ Client client = new Client(clientLocator);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connection.
+ if ("abc".equals(client.invoke("abc")))
+ log.info("connection is good");
+ else
+ log.info("Should have gotten \"abc\" in reply");
+
+ // Set up push callbacks. Tell the Connector created by Client.addListener()
+ // that it is a callback Connector, which tells the BisocketServerInvoker
+ // not to create a ServerSocket.
+ HashMap metadata = new HashMap();
+ metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ client.addListener(callbackHandler, metadata);
+
+ // Use reflection to verify that the callback BisocketServerInvoker did not
+ // create a ServerSocket.
+ Set callbackConnectors = client.getCallbackConnectors(callbackHandler);
+ if (callbackConnectors.size() != 1)
+ {
+ log.info("There should be one callback Connector");
+ }
+ else
+ {
+ Connector callbackConnector = (Connector) callbackConnectors.iterator().next();
+ BisocketServerInvoker serverInvoker = (BisocketServerInvoker) callbackConnector.getServerInvoker();
+ Field field = SocketServerInvoker.class.getDeclaredField("serverSockets");
+ field.setAccessible(true);
+ List serverSockets = (List) field.get(serverInvoker);
+ log.info("number of ServerSockets held by callback BisocketServerInvoker: " + serverSockets.size());
+ }
+
+ // Request callback.
+ client.invoke("CALLBACK");
+ if (callbackHandler.getCounter() == 1)
+ log.info("received callback");
+ else
+ log.info("didn't receive callback");
+
+ client.removeListener(callbackHandler);
+ client.disconnect();
+ }
+
+
+ public static void main(String[] args)
+ {
+ // Configure logging.
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+
+ try
+ {
+ String host = InetAddress.getLocalHost().getHostName();
+ int port = BisocketSampleServer.port;
+ String locatorURI = "bisocket://" + host + ":" + port;
+ BisocketSampleClient client = new BisocketSampleClient();
+ client.makeInvocation(locatorURI);
+ }
+ catch(Throwable e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * An InvokerCallbackHandler is registered with the callback Connector, which
+ * passes push callbacks to it by way of the handleCallback() method.
+ * </p>
+ */
+ static class TestCallbackHandler implements InvokerCallbackHandler
+ {
+ private int counter;
+
+ public void handleCallback(Callback callback) throws HandleCallbackException
+ {
+ counter++;
+ }
+
+ public int getCounter()
+ {
+ return counter;
+ }
+ }
+}
\ No newline at end of file
Added: remoting2/branches/2.x/src/main/org/jboss/remoting/samples/bisocket/BisocketSampleServer.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/samples/bisocket/BisocketSampleServer.java (rev 0)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/samples/bisocket/BisocketSampleServer.java 2008-05-02 03:16:37 UTC (rev 4117)
@@ -0,0 +1,168 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.remoting.samples.bisocket;
+
+import java.net.InetAddress;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import javax.management.MBeanServer;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+
+
+/**
+ * This class and org.jboss.remoting.samples.bisocket.BisocketSampleClient
+ * demonstrate how to how to make an invocation and how to set up push callbacks
+ * over the bisocket transport.
+ *
+ * The reason for the existance of the bisocket transport, which is derived from the
+ * socket transport, is to make it possible to do push callbacks to a client which
+ * is unable to create a ServerSocket, either due to security restrictions or due
+ * to the fact that it is behind a firewall.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 1, 2008
+ * </p>
+ */
+public class BisocketSampleServer
+{
+ public static int port = 4567;
+
+ private static Logger log = Logger.getLogger(BisocketSampleServer.class);
+
+ protected Connector connector;
+
+
+ protected void setupServer(String locatorURI) throws Exception
+ {
+ // Create the InvokerLocator based on url string format
+ // to indicate the transport, host, and port to use for the
+ // server invoker.
+ InvokerLocator serverLocator = new InvokerLocator(locatorURI);
+
+ connector = new Connector(serverLocator);
+
+ // Creates all the connector's needed resources, such as the server invoker.
+ connector.create();
+
+ // Create the handler to receive the invocation request from the client for processing.
+ SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+
+ // Start server.
+ connector.start();
+ log.info("Started remoting server with locator uri of: " + locatorURI);
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ {
+ connector.stop();
+ log.info("shut down server");
+ }
+ }
+
+
+ public static void main(String[] args)
+ {
+ try
+ {
+ // Configure logging.
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+
+ // Create and start server.
+ String host = InetAddress.getLocalHost().getHostAddress();
+ String locatorURI = "bisocket://" + host + ":" + port;
+ BisocketSampleServer server = new BisocketSampleServer();
+ server.setupServer(locatorURI);
+
+ // Wait until user types a character on command line.
+ System.in.read();
+
+ // Shut down server.
+ server.shutdownServer();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ * Invocations are handled by the ServerInvocationHandler.
+ */
+ static class SampleInvocationHandler implements ServerInvocationHandler
+ {
+ private HashSet callbackHandlers = new HashSet();
+
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ callbackHandlers.add(callbackHandler);
+ }
+
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ Object param = invocation.getParameter();
+ if ("CALLBACK".equals(param))
+ {
+ Iterator it = callbackHandlers.iterator();
+ while (it.hasNext())
+ {
+ InvokerCallbackHandler handler = (InvokerCallbackHandler) it.next();
+ handler.handleCallback(new Callback("callback"));
+ }
+ }
+ return param;
+ }
+
+ public void removeListener(InvokerCallbackHandler callbackHandler)
+ {
+ callbackHandlers.remove(callbackHandler);
+ }
+
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+}
\ No newline at end of file
16 years, 8 months
JBoss Remoting SVN: r4116 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/multihome.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-05-01 22:34:08 -0400 (Thu, 01 May 2008)
New Revision: 4116
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/multihome/BisocketMultihomeTestCase.java
Log:
JBREM-930: Now passes in SSL parameters to Connector constructor.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/multihome/BisocketMultihomeTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/multihome/BisocketMultihomeTestCase.java 2008-05-02 01:57:26 UTC (rev 4115)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/multihome/BisocketMultihomeTestCase.java 2008-05-02 02:34:08 UTC (rev 4116)
@@ -28,6 +28,7 @@
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -87,7 +88,9 @@
String secondaryBindPortsString = sb.toString();
log.info("secondaryBindPorts: " + secondaryBindPortsString);
locatorURI += "&" + Bisocket.SECONDARY_BIND_PORTS + "=" + secondaryBindPortsString;
- connector = new Connector(locatorURI);
+ HashMap config = new HashMap();
+ addExtraServerConfig(config);
+ connector = new Connector(locatorURI, config);
connector.create();
invocationHandler = new TestInvocationHandler();
connector.addInvocationHandler("test", invocationHandler);
@@ -164,8 +167,9 @@
log.info("secondaryConnectPorts: " + secondaryConnectPortsString);
locatorURI += "&" + Bisocket.SECONDARY_CONNECT_PORTS + "=" + secondaryConnectPortsString;
log.info("locatorURI: " + locatorURI);
-
- connector = new Connector(locatorURI);
+ HashMap config = new HashMap();
+ addExtraServerConfig(config);
+ connector = new Connector(locatorURI, config);
connector.create();
invocationHandler = new TestInvocationHandler();
connector.addInvocationHandler("test", invocationHandler);
@@ -245,8 +249,9 @@
log.info("secondaryConnectPorts: " + secondaryConnectPortsString);
locatorURI += "&" + Bisocket.SECONDARY_CONNECT_PORTS + "=" + secondaryConnectPortsString;
log.info("locatorURI: " + locatorURI);
-
- connector = new Connector(locatorURI);
+ HashMap config = new HashMap();
+ addExtraServerConfig(config);
+ connector = new Connector(locatorURI, config);
connector.create();
invocationHandler = new TestInvocationHandler();
connector.addInvocationHandler("test", invocationHandler);
16 years, 8 months
JBoss Remoting SVN: r4115 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/oneway.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-05-01 21:57:26 -0400 (Thu, 01 May 2008)
New Revision: 4115
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/oneway/OnewayConnectionManagerTestCase.java
Log:
JBREM-930: In testDefaultTimeoutWithTimeouts() wait longer for invocations to start on server side.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/oneway/OnewayConnectionManagerTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/oneway/OnewayConnectionManagerTestCase.java 2008-05-02 01:41:25 UTC (rev 4114)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/oneway/OnewayConnectionManagerTestCase.java 2008-05-02 01:57:26 UTC (rev 4115)
@@ -138,6 +138,11 @@
}
assertEquals(0, pool.size());
+ for (int i = 0; i < 5; i++)
+ {
+ if (handler.startedCount == INVOCATIONS) break;
+ Thread.sleep(1000);
+ }
assertEquals(INVOCATIONS, handler.startedCount);
Thread.sleep(4000);
16 years, 8 months
JBoss Remoting SVN: r4114 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-05-01 21:41:25 -0400 (Thu, 01 May 2008)
New Revision: 4114
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java
Log:
JBREM-930: Doesn't change counters if notification is from extraneous servers.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java 2008-05-01 22:21:57 UTC (rev 4113)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java 2008-05-02 01:41:25 UTC (rev 4114)
@@ -181,28 +181,36 @@
log.info("Received notification: " + notification);
if (notification instanceof NetworkNotification)
{
+ int tempAdded = 0;
NetworkNotification netNot = (NetworkNotification) notification;
if(NetworkNotification.SERVER_ADDED.equals(netNot.getType()))
{
- numOfAdded = 0;
InvokerLocator[] locators = netNot.getLocator();
for (int i = 0; i < locators.length; i++)
{
if (locators[i].isSameEndpoint(locator1) || locators[i].isSameEndpoint(locator2))
- numOfAdded++;
+ tempAdded++;
}
- log.info("server added. num of locators added = " + numOfAdded);
+ if (tempAdded > 0)
+ {
+ numOfAdded = tempAdded;
+ log.info("server added. num of locators added = " + numOfAdded);
+ }
}
else if(NetworkNotification.SERVER_UPDATED.equals(netNot.getType()))
{
- numOfUpdated = 0;
+ int tempUpdated = 0;
InvokerLocator[] locators = netNot.getLocator();
for (int i = 0; i < locators.length; i++)
{
if (locators[i].isSameEndpoint(locator1) || locators[i].isSameEndpoint(locator2))
- numOfUpdated++;
+ tempUpdated++;
}
- log.info("server updated. num of locators in update = " + numOfUpdated);
+ if (tempUpdated > 0)
+ {
+ numOfUpdated = tempUpdated;
+ log.info("server updated. num of locators in update = " + numOfUpdated);
+ }
}
ServerInvokerMetadata[] serverMetadata = netNot.getServerInvokers();
log.info(netNot.getIdentity());
16 years, 8 months
JBoss Remoting SVN: r4113 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-05-01 18:21:57 -0400 (Thu, 01 May 2008)
New Revision: 4113
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestCase.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestClient.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java
Log:
JBREM-930: Allow more time to recreate ServerSocket.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestCase.java 2008-05-01 22:18:39 UTC (rev 4112)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestCase.java 2008-05-01 22:21:57 UTC (rev 4113)
@@ -24,4 +24,14 @@
{
return XLevel.TRACE;
}
+
+ protected long getResultsTimeout()
+ {
+ return 480000;
+ }
+
+ protected long getRunTestTimeout()
+ {
+ return 480000;
+ }
}
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestClient.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestClient.java 2008-05-01 22:18:39 UTC (rev 4112)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestClient.java 2008-05-01 22:21:57 UTC (rev 4113)
@@ -59,7 +59,7 @@
log.info("finished first sleep in tearDown()");
client.disconnect();
log.info("disconnected client in tearDown()");
- Thread.sleep(10000);
+ Thread.sleep(350000);
log.info("finished second sleep in tearDown()");
try {
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java 2008-05-01 22:18:39 UTC (rev 4112)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java 2008-05-01 22:21:57 UTC (rev 4113)
@@ -120,7 +120,7 @@
log.info("invocation done");
String keyStorePath2 = this.getClass().getResource("certificate/serverTrustStore2").getFile();
((SocketServerInvoker) connector.getServerInvoker()).setNewServerSocketFactory(createServerSocketFactory(keyStorePassword,trustStorePassword,keyStorePath,keyStorePath2));
- Thread.sleep(20000);//let client build up connection a second time
+ Thread.sleep(250000);//let client build up connection a second time
log.info("leaving test()");
}
16 years, 8 months
JBoss Remoting SVN: r4112 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-05-01 18:18:39 -0400 (Thu, 01 May 2008)
New Revision: 4112
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
Log:
JBREM-930: refreshServerSocket() closes old ServerSocket before recreating it.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2008-05-01 21:57:23 UTC (rev 4111)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2008-05-01 22:18:39 UTC (rev 4112)
@@ -170,9 +170,10 @@
ServerSocket oldServerSocket = acceptThreads[i].getServerSocket();
InetAddress address = oldServerSocket.getInetAddress();
int port = oldServerSocket.getLocalPort();
+ oldServerSocket.close();
ServerSocket newServerSocket = null;
- for (int j = 0; j < 4; j++)
+ for (int j = 0; j < 5; j++)
{
try
{
@@ -181,7 +182,7 @@
}
catch (Exception e)
{
- if (j < 3)
+ if (j < 4)
{
// Wait for end of TIME_WAIT state (1 to 4 minutes).
log.warn("Unable to recreate ServerSocket: will try again in 65 seconds", e);
@@ -196,7 +197,6 @@
}
acceptThreads[i].setServerSocket(newServerSocket);
- oldServerSocket.close();
log.info(acceptThreads[i] + " has been updated with new ServerSocket");
}
}
@@ -1029,7 +1029,6 @@
if(running)
{
log.error(this + " failed to handle socket", ex);
- if (serverSocket.isClosed()) return;
}
else
{
16 years, 8 months
JBoss Remoting SVN: r4111 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-05-01 17:57:23 -0400 (Thu, 01 May 2008)
New Revision: 4111
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorClient.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorServer.java
Log:
JBREM-930: Add extra time for server to be registered.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorClient.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorClient.java 2008-05-01 21:01:12 UTC (rev 4110)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorClient.java 2008-05-01 21:57:23 UTC (rev 4111)
@@ -72,6 +72,7 @@
public void testDetection() throws Exception
{
detector.start();
+ Thread.sleep(4000);
long start = System.currentTimeMillis();
NetworkInstance[] instances = detector.forceDetection();
long end = System.currentTimeMillis();
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorServer.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorServer.java 2008-05-01 21:01:12 UTC (rev 4110)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorServer.java 2008-05-01 21:57:23 UTC (rev 4111)
@@ -101,7 +101,7 @@
detector.setContextFactory(contextFactory);
detector.setURLPackage(urlPackage);
detector.start();
-
+ Thread.sleep(10000);
}
public void tearDown() throws Exception
16 years, 8 months
JBoss Remoting SVN: r4110 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-05-01 17:01:12 -0400 (Thu, 01 May 2008)
New Revision: 4110
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java
Log:
JBREM-930: Sets reuseAddress to true.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java 2008-05-01 21:00:42 UTC (rev 4109)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java 2008-05-01 21:01:12 UTC (rev 4110)
@@ -65,6 +65,7 @@
configuration.put(SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH, trustStorePath);
configuration.put(SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD, trustStorePassword);
configuration.put(SSLSocketBuilder.REMOTING_TRUST_STORE_ALGORITHM, "SunX509");
+ configuration.put("reuseAddress", "true");
connector = new Connector(configuration);
InvokerLocator locator = new InvokerLocator(getTransport() + "://"+localHost+":"+port);
16 years, 8 months
JBoss Remoting SVN: r4109 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-05-01 17:00:42 -0400 (Thu, 01 May 2008)
New Revision: 4109
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
Log:
JBREM-930: Makes multiple attempts to replace ServerSocket.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2008-05-01 07:20:45 UTC (rev 4108)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2008-05-01 21:00:42 UTC (rev 4109)
@@ -170,7 +170,31 @@
ServerSocket oldServerSocket = acceptThreads[i].getServerSocket();
InetAddress address = oldServerSocket.getInetAddress();
int port = oldServerSocket.getLocalPort();
- ServerSocket newServerSocket = createServerSocket(port, backlog, address);
+ ServerSocket newServerSocket = null;
+
+ for (int j = 0; j < 4; j++)
+ {
+ try
+ {
+ newServerSocket = createServerSocket(port, backlog, address);
+ break;
+ }
+ catch (Exception e)
+ {
+ if (j < 3)
+ {
+ // Wait for end of TIME_WAIT state (1 to 4 minutes).
+ log.warn("Unable to recreate ServerSocket: will try again in 65 seconds", e);
+ try {Thread.sleep(65000);} catch (InterruptedException ignored) {}
+ }
+ else
+ {
+ log.error("Unable to recreate ServerSocket after 260 seconds", e);
+ return;
+ }
+ }
+ }
+
acceptThreads[i].setServerSocket(newServerSocket);
oldServerSocket.close();
log.info(acceptThreads[i] + " has been updated with new ServerSocket");
@@ -793,12 +817,11 @@
{
log.debug("refreshing server socket");
refreshServerSocket();
+ log.debug("server socket refreshed");
} catch (IOException e)
{
- log.debug("could not refresh server socket");
- log.debug("message is: "+e.getMessage());
+ log.error("could not refresh server socket", e);
}
- log.debug("server socket refreshed");
}
try
16 years, 8 months