JBoss Remoting SVN: r4098 - 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-04-30 01:31:09 -0400 (Wed, 30 Apr 2008)
New Revision: 4098
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
Log:
JBREM-930: AcceptThread returns if ServerSocket is closed.
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-04-30 05:30:14 UTC (rev 4097)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2008-04-30 05:31:09 UTC (rev 4098)
@@ -170,9 +170,9 @@
ServerSocket oldServerSocket = acceptThreads[i].getServerSocket();
InetAddress address = oldServerSocket.getInetAddress();
int port = oldServerSocket.getLocalPort();
- oldServerSocket.close();
ServerSocket newServerSocket = createServerSocket(port, backlog, address);
acceptThreads[i].setServerSocket(newServerSocket);
+ oldServerSocket.close();
log.info(acceptThreads[i] + " has been updated with new ServerSocket");
}
}
@@ -1006,6 +1006,7 @@
if(running)
{
log.error(this + " failed to handle socket", ex);
+ if (serverSocket.isClosed()) return;
}
else
{
16 years, 6 months
JBoss Remoting SVN: r4097 - 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-04-30 01:30:14 -0400 (Wed, 30 Apr 2008)
New Revision: 4097
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java
Log:
JBREM-930: Eliminated invalid ObjectName problem.
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-04-30 05:15:45 UTC (rev 4096)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java 2008-04-30 05:30:14 UTC (rev 4097)
@@ -69,6 +69,8 @@
InvokerLocator locator = new InvokerLocator(getTransport() + "://"+localHost+":"+port);
connector.setInvokerLocator(locator.getLocatorURI());
+ server=MBeanServerFactory.createMBeanServer();
+ server.registerMBean(connector, new ObjectName("jboss.remoting:type=Connector"));
connector.create();
//make it SSL-ready for clients that want to build up connection:
@@ -85,10 +87,8 @@
e.printStackTrace();
}
+ connector.addInvocationHandler("Sample",new Sample());
connector.start();
- server=MBeanServerFactory.createMBeanServer();
- server.registerMBean(connector, new ObjectName("jboss.remoting:type=Connector"));
- connector.addInvocationHandler("Sample",new Sample());
log.info("leaving setUp()");
}
catch(Exception e){
16 years, 6 months
JBoss Remoting SVN: r4096 - 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-04-30 01:15:45 -0400 (Wed, 30 Apr 2008)
New Revision: 4096
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java
Log:
JBREM-930: Restricted time spent waiting on invocationDone.
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-04-30 01:18:21 UTC (rev 4095)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestServer.java 2008-04-30 05:15:45 UTC (rev 4096)
@@ -110,10 +110,12 @@
public void test() throws Exception
{
log.info("entering test()");
- while(!invocationDone)
+ for (int i = 0; i < 5; i++)
{
- Thread.sleep(1000);
+ if (invocationDone) break;
+ Thread.sleep(2000);
}
+ assertTrue(invocationDone);
log.info("invocation done");
String keyStorePath2 = this.getClass().getResource("certificate/serverTrustStore2").getFile();
((SocketServerInvoker) connector.getServerInvoker()).setNewServerSocketFactory(createServerSocketFactory(keyStorePassword,trustStorePassword,keyStorePath,keyStorePath2));
16 years, 6 months
JBoss Remoting SVN: r4095 - 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-04-29 21:18:21 -0400 (Tue, 29 Apr 2008)
New Revision: 4095
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorServer.java
Log:
JBREM-930: Returned to previous version.
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-04-30 00:09:36 UTC (rev 4094)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorServer.java 2008-04-30 01:18:21 UTC (rev 4095)
@@ -54,13 +54,14 @@
// start JNDI server
int port = 1099;
String host = InetAddress.getLocalHost().getHostName();
- String bindAddr = System.getProperty("jrunit.bind_addr", host);
Main JNDIServer = new Main();
JNDIServer.setPort(port);
- JNDIServer.setBindAddress(bindAddr);
+ JNDIServer.setBindAddress(host);
JNDIServer.start();
- System.out.println("Started JNDI server on " + bindAddr + ":" + port);
+ System.out.println("Started JNDI server on " + host + ":" + port);
+ String detectorHost = InetAddress.getLocalHost().getHostName();
+
detector = new JNDIDetector();
detector.setCleanDetectionNumber(2);
@@ -75,6 +76,7 @@
port = TestUtil.getRandomPort();
System.out.println("port = " + port);
+ String bindAddr = System.getProperty("jrunit.bind_addr", host);
InvokerLocator locator = new InvokerLocator("socket://" + bindAddr + ":" + port);
System.out.println("Starting remoting server with locator uri of: " + locator.getLocatorURI());
@@ -95,7 +97,7 @@
// set config info for detector and start it.
detector.setPort(detectorPort);
- detector.setHost(bindAddr);
+ detector.setHost(detectorHost);
detector.setContextFactory(contextFactory);
detector.setURLPackage(urlPackage);
detector.start();
16 years, 6 months
JBoss Remoting SVN: r4094 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/deploy.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-29 20:09:36 -0400 (Tue, 29 Apr 2008)
New Revision: 4094
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/deploy/DualDeploymentTestCase.java
Log:
JBREM-930: Eliminated testNoSubsystem().
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/deploy/DualDeploymentTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/deploy/DualDeploymentTestCase.java 2008-04-29 08:41:39 UTC (rev 4093)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/deploy/DualDeploymentTestCase.java 2008-04-30 00:09:36 UTC (rev 4094)
@@ -131,12 +131,26 @@
}
/**
+ * Disabling this test.
+ *
+ * org.jboss.remoting.ServerInvoker is not written to support
+ * the assertion "should always use the last handler added" made below.
+ *
+ * There are two choices:
+ *
+ * 1. Implement the feature, or
+ * 2. Eliminate the test.
+ *
+ * Since there is no provision in the Remoting Guide that supports this feature, and
+ * it doesn't seem particularly useful, we'll leave the ServerInvoker code alone
+ * and eliminate the test. - Ron Sigal, 4/29/08
+ *
* If multiple handlers added to connector (thus server invoker) and subsystem is NOT
* specified in client, then will be processed by last handler added.
*
* @throws Throwable
*/
- public void testNoSubsystem() throws Throwable
+ public void xtestNoSubsystem() throws Throwable
{
MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
16 years, 6 months
JBoss Remoting SVN: r4093 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/lifecycle.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-29 04:41:39 -0400 (Tue, 29 Apr 2008)
New Revision: 4093
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/lifecycle/InvokerLifecycleTestCase.java
Log:
JBREM-930: Eliminated hard coded host and port.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/lifecycle/InvokerLifecycleTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/lifecycle/InvokerLifecycleTestCase.java 2008-04-29 07:21:54 UTC (rev 4092)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/lifecycle/InvokerLifecycleTestCase.java 2008-04-29 08:41:39 UTC (rev 4093)
@@ -26,6 +26,7 @@
import org.jboss.remoting.InvalidConfigurationException;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
import java.net.InetAddress;
import java.net.ServerSocket;
@@ -70,7 +71,10 @@
public void testNonConcurrentConnectors() throws Exception
{
- InvokerLocator serverLocator = new InvokerLocator("socket://localhost:2222");
+ String defaultHost = InetAddress.getLocalHost().getHostName();
+ String host = System.getProperty("jrunit.bind_addr", defaultHost);
+ int port = PortUtil.findFreePort(host);
+ InvokerLocator serverLocator = new InvokerLocator("socket://" + host + ":" + port);
Connector connector1 = new Connector();
connector1.setInvokerLocator(serverLocator.getLocatorURI());
connector1.start();
16 years, 7 months
JBoss Remoting SVN: r4092 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/metadata.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-29 03:21:54 -0400 (Tue, 29 Apr 2008)
New Revision: 4092
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/metadata/MetadataTestCase.java
Log:
JBREM-930: Account for possibility that extraneous servers might be discovered.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/metadata/MetadataTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/metadata/MetadataTestCase.java 2008-04-29 06:37:37 UTC (rev 4091)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/metadata/MetadataTestCase.java 2008-04-29 07:21:54 UTC (rev 4092)
@@ -25,9 +25,15 @@
import junit.framework.TestCase;
import org.apache.log4j.Level;
import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+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.InvokerCallbackHandler;
import org.jboss.remoting.detection.ServerInvokerMetadata;
import org.jboss.remoting.detection.multicast.MulticastDetector;
+import org.jboss.remoting.network.NetworkInstance;
import org.jboss.remoting.network.NetworkNotification;
import org.jboss.remoting.network.NetworkRegistry;
import org.jboss.remoting.transport.Connector;
@@ -45,6 +51,7 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.List;
+import java.util.Random;
/**
* Just tests that detector A sees detector B when B comes online then off.
@@ -54,6 +61,8 @@
*/
public class MetadataTestCase extends TestCase implements NotificationListener
{
+ private static int secret = Math.abs(new Random().nextInt(2000));
+
private String subSystem = null;
public MetadataTestCase(String name)
@@ -98,10 +107,12 @@
//Should now have an entry for both of the registries
int reg1Count = reg1.getServers().length;
int reg2Count = reg2.getServers().length;
-
- if(reg1Count == 1 && reg2Count == 1)
+ System.out.println("registry 1: " + reg1Count);
+ System.out.println("registry 2: " + reg2Count);
+
+ if(reg1Count >= 1 && reg2Count >= 1)
{
- System.out.println("PASSED - both registries have found the detectors.");
+ System.out.println("PASSED - both registries have found detectors.");
}
else
{
@@ -109,7 +120,11 @@
}
// Actual junit test
- assertTrue(reg1Count == 1 && reg2Count == 1);
+ assertTrue(reg1Count >= 1 && reg2Count >= 1);
+
+ // Verify the Connectors created by this test have been detected.
+ checkForConnector(reg1);
+ checkForConnector(reg2);
// now check to make sure got the subsystem as expected
assertEquals("MOCK", subSystem);
@@ -162,7 +177,7 @@
StringBuffer buf = new StringBuffer();
buf.append("<?xml version=\"1.0\"?>\n");
buf.append("<handlers>\n");
- buf.append(" <handler subsystem=\"mock\">org.jboss.test.remoting.transport.mock.MockServerInvocationHandler</handler>\n");
+ buf.append(" <handler subsystem=\"mock\">" + TestInvocationHandler.class.getName() + "</handler>\n");
buf.append("</handlers>\n");
Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(buf.toString().getBytes()));
connector.setInvokerLocator(locator.getLocatorURI());
@@ -198,6 +213,36 @@
}
}
+ private boolean checkForConnector(NetworkRegistry registry)
+ {
+ boolean found = false;
+ NetworkInstance[] servers1 = registry.getServers();
+ for (int i = 0; i < servers1.length; i++)
+ {
+ InvokerLocator[] locators = servers1[i].getLocators();
+ for (int j = 0; j < locators.length; j++)
+ {
+ try
+ {
+ Client client = new Client(locators[j]);
+ client.connect();
+ if (secret == ((Integer) client.invoke("abc")).intValue())
+ {
+ found = true;
+ System.out.println("FOUND: " + locators[j]);
+ break;
+ }
+ }
+ catch (Throwable t)
+ {
+ continue;
+ }
+ }
+ }
+
+ return found;
+ }
+
private static class TestNetworkRegistry extends NetworkRegistry
{
public static NetworkRegistry createNetworkRegistry()
@@ -206,4 +251,15 @@
}
}
+ public static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return new Integer(secret);
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
}
16 years, 7 months
JBoss Remoting SVN: r4091 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/metadata.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-29 02:37:37 -0400 (Tue, 29 Apr 2008)
New Revision: 4091
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/metadata/MetadataTestCase.java
Log:
JBREM-930: Fixed ArrayIndexOutOfBoundsException.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/metadata/MetadataTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/metadata/MetadataTestCase.java 2008-04-29 06:34:56 UTC (rev 4090)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/metadata/MetadataTestCase.java 2008-04-29 06:37:37 UTC (rev 4091)
@@ -193,7 +193,8 @@
{
NetworkNotification netNot = (NetworkNotification) notification;
ServerInvokerMetadata[] serverMetadata = netNot.getServerInvokers();
- subSystem = serverMetadata[0].getSubSystems()[0];
+ if (serverMetadata.length > 0)
+ subSystem = serverMetadata[0].getSubSystems()[0];
}
}
16 years, 7 months
JBoss Remoting SVN: r4090 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-29 02:34:56 -0400 (Tue, 29 Apr 2008)
New Revision: 4090
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java
Log:
JBREM-930: Added "this" to log statements.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java 2008-04-29 06:06:13 UTC (rev 4089)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java 2008-04-29 06:34:56 UTC (rev 4090)
@@ -202,7 +202,7 @@
catch (Exception e)
{
{
- log.warn("Error stopping multicast detector. " + e.getMessage());
+ log.warn(this + " Error stopping multicast detector. " + e.getMessage());
} }
listener = null;
}
@@ -215,7 +215,7 @@
}
catch (IOException e)
{
- log.warn("Error stopping multicast detector. " + e.getMessage());
+ log.warn(this + " Error stopping multicast detector. " + e.getMessage());
}
socket = null;
}
@@ -234,7 +234,7 @@
{
if(log.isTraceEnabled())
{
- log.trace("sending heartbeat: " + msg);
+ log.trace(this + " sending heartbeat: " + msg);
}
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream objectOut = new ObjectOutputStream(byteOut);
@@ -248,7 +248,7 @@
catch(Throwable ex)
{
// its failed
- log.debug("heartbeat failed", ex);
+ log.debug(this + " heartbeat failed", ex);
}
}
}
@@ -283,7 +283,7 @@
catch(Throwable ex)
{
// its failed
- log.debug("forced heartbeat failed", ex);
+ log.debug(this + " forced heartbeat failed", ex);
}
}
}
@@ -306,7 +306,7 @@
Detection msg = (Detection)obj;
if(log.isTraceEnabled())
{
- log.trace("received detection: " + msg);
+ log.trace(this + " received detection: " + msg);
}
// let the subclass do the hard work off handling detection
@@ -327,7 +327,7 @@
}
if(socket != null)
{
- log.debug("Error receiving detection", e);
+ log.debug(this + " Error receiving detection", e);
}
}
}
16 years, 7 months
JBoss Remoting SVN: r4089 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/binding.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-29 02:06:13 -0400 (Tue, 29 Apr 2008)
New Revision: 4089
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/binding/BindingTestCase.java
Log:
JBREM-930: Eliminated hard coded ports.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/binding/BindingTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/binding/BindingTestCase.java 2008-04-29 06:01:09 UTC (rev 4088)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/binding/BindingTestCase.java 2008-04-29 06:06:13 UTC (rev 4089)
@@ -59,7 +59,8 @@
public void testBindingWithLocatorByName() throws Exception
{
System.setProperty(InvokerLocator.BIND_BY_HOST, "true");
- String locatorUrl = "socket://0.0.0.0:5600";
+ int bindPort = PortUtil.findFreePort("0.0.0.0");
+ String locatorUrl = "socket://0.0.0.0:" + bindPort;
Connector connector = new Connector(locatorUrl);
connector.create();
@@ -100,7 +101,8 @@
public void testBindingWithLocatorByAddress() throws Exception
{
System.setProperty(InvokerLocator.BIND_BY_HOST, "false");
- String locatorUrl = "socket://0.0.0.0:5600";
+ int bindPort = PortUtil.findFreePort("0.0.0.0");
+ String locatorUrl = "socket://0.0.0.0:" + bindPort;
Connector connector = new Connector(locatorUrl);
connector.create();
16 years, 7 months