From jboss-remoting-commits at lists.jboss.org Tue May 31 23:36:13 2011 Content-Type: multipart/mixed; boundary="===============2922155492567588977==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6375 - in remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket: idle and 1 other directory. Date: Tue, 31 May 2011 23:36:07 -0400 Message-ID: <201106010336.p513a7cF002690@svn01.web.mwc.hst.phx2.redhat.com> --===============2922155492567588977== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2011-05-31 23:36:04 -0400 (Tue, 31 May 2011) New Revision: 6375 Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socke= t/idle/ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socke= t/idle/ThreadPoolStackTestCase.java Log: JBREM-1293: New unit test. Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/s= ocket/idle/ThreadPoolStackTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java (rev 0) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java 2011-06-01 03:36:04 UTC (rev 6375) @@ -0,0 +1,213 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file 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.test.remoting.transport.socket.idle; + +import java.lang.reflect.Field; +import java.net.InetAddress; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.management.MBeanServer; + +import junit.framework.TestCase; + +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.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.transport.Connector; +import org.jboss.remoting.transport.PortUtil; +import org.jboss.remoting.transport.socket.LRUPool; +import org.jboss.remoting.transport.socket.SocketServerInvoker; + + +/** + * JBREM-1293. + * = + * @author Ron Sigal + * @version $Revision: 1.1 $ + *

+ * Copyright May 31, 2011 + */ +public class ThreadPoolStackTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(ThreadPoolStackTestCase.= class); + = + private static boolean firstTime =3D true; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + + = + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testThreadpoolAsStack() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Get threadpool and clientpool. + Field field =3D SocketServerInvoker.class.getDeclaredField("threadpo= ol"); + field.setAccessible(true); + List threadpool =3D (List) field.get(connector.getServerInvoker()); + field =3D SocketServerInvoker.class.getDeclaredField("clientpool"); + field.setAccessible(true); + LRUPool clientpool =3D (LRUPool) field.get(connector.getServerInvoke= r()); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + Thread.sleep(2000); + = + // Create 5 connections. + for (int i =3D 0; i < 5; i++) + { + client.invokeOneway("4", null, true); + } + + Thread.sleep(2000); // time =3D 4000 + assertEquals(0, threadpool.size()); + assertEquals(5, clientpool.size()); + = + // ServerThreads should be back in threadpool at 6000. + client.disconnect(); + Thread.sleep(4000); // time =3D 8000 + assertEquals(5, threadpool.size()); + assertEquals(0, clientpool.size()); + = + // Wait until IdleTimerTask runs at 10000. + Thread.sleep(4000); // time =3D 12000 + = + for (int i =3D 0; i < 6; i++) + { + client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("i =3D " + i); + client.invoke("1"); + client.disconnect(); + } + = + // Time =3D 18000. IdleTimerTask will run at 20000, at which point + // all but one ServerThread should be removed from threadpool. + Thread.sleep(4000); // time =3D 22000 + assertEquals(1, threadpool.size()); + = + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + protected String getTransport() + { + return "socket"; + } + = + = + protected void addExtraClientConfig(Map config) {} + protected void addExtraServerConfig(Map config) {} + = + + protected void setupServer() throws Exception + { + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + config.put("idleTimeout", "10"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + Integer.valueOf((String) invocation.getParameter()).intValue(); + Thread.sleep(Integer.valueOf((String) invocation.getParameter()).= intValue() * 1000); + log.info("parameter: " + invocation.getParameter()); + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } +} \ No newline at end of file Property changes on: remoting2/branches/2.2/src/tests/org/jboss/test/remoti= ng/transport/socket/idle/ThreadPoolStackTestCase.java ___________________________________________________________________ Added: svn:executable + * --===============2922155492567588977==-- From jboss-remoting-commits at lists.jboss.org Tue May 31 23:37:46 2011 Content-Type: multipart/mixed; boundary="===============5728794097042448963==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6376 - remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket. Date: Tue, 31 May 2011 23:37:46 -0400 Message-ID: <201106010337.p513bk9Y002977@svn01.web.mwc.hst.phx2.redhat.com> --===============5728794097042448963== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2011-05-31 23:37:46 -0400 (Tue, 31 May 2011) New Revision: 6376 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/Sock= etServerInvoker.java Log: JBREM-1293: Treat threadpool as a stack, removing last element when reusing= a ServerThread. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sock= et/SocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.java 2011-06-01 03:36:04 UTC (rev 6375) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.java 2011-06-01 03:37:46 UTC (rev 6376) @@ -611,7 +611,7 @@ { if(threadpool.size() > 0) { - worker =3D (ServerThread)threadpool.removeFirst(); + worker =3D (ServerThread)threadpool.removeLast(); = if(trace) { log.trace(this + (worker =3D=3D null ? " found = NO threads in threadpool" : " got " + worker + " from threadpool")); } } --===============5728794097042448963==-- From jboss-remoting-commits at lists.jboss.org Tue May 31 23:40:26 2011 Content-Type: multipart/mixed; boundary="===============8131929194131708031==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6377 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Tue, 31 May 2011 23:40:26 -0400 Message-ID: <201106010340.p513eQRV003377@svn01.web.mwc.hst.phx2.redhat.com> --===============8131929194131708031== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2011-05-31 23:40:26 -0400 (Tue, 31 May 2011) New Revision: 6377 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Sock= etServerInvoker.java Log: JBREM-1293: Treat threadpool as a stack, removing last element when reusing= a ServerThread. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/SocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.java 2011-06-01 03:37:46 UTC (rev 6376) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.java 2011-06-01 03:40:26 UTC (rev 6377) @@ -791,7 +791,7 @@ = if(threadpool.size() > 0) { - worker =3D (ServerThread)threadpool.removeFirst(); + worker =3D (ServerThread)threadpool.removeLast(); if(trace) { log.trace(this + (worker =3D=3D null ? " found = NO threads in threadpool" : " got " + wo= rker + " from threadpool")); } = --===============8131929194131708031==-- From jboss-remoting-commits at lists.jboss.org Tue May 31 23:41:31 2011 Content-Type: multipart/mixed; boundary="===============2145410814023623296==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6378 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket: idle and 1 other directory. Date: Tue, 31 May 2011 23:41:31 -0400 Message-ID: <201106010341.p513fVGA003454@svn01.web.mwc.hst.phx2.redhat.com> --===============2145410814023623296== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2011-05-31 23:41:30 -0400 (Tue, 31 May 2011) New Revision: 6378 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/idle/ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/idle/ThreadPoolStackTestCase.java Log: JBREM-1293: New unit test. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ocket/idle/ThreadPoolStackTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java 2011-06-01 03:41:30 UTC (rev 6378) @@ -0,0 +1,212 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file 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.test.remoting.transport.socket.idle; + +import java.lang.reflect.Field; +import java.net.InetAddress; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.management.MBeanServer; + +import junit.framework.TestCase; + +import org.apache.log4j.ConsoleAppender; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.log4j.PatternLayout; +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.transport.Connector; +import org.jboss.remoting.transport.PortUtil; +import org.jboss.remoting.transport.socket.LRUPool; +import org.jboss.remoting.transport.socket.SocketServerInvoker; + + +/** + * JBREM-1293. + * = + * @author Ron Sigal + * @version $Revision: 1.1 $ + *

+ * Copyright May 31, 2011 + */ +public class ThreadPoolStackTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(ThreadPoolStackTestCase.= class); + = + private static boolean firstTime =3D true; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + + = + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.TRACE); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testThreadpoolAsStack() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Get threadpool and clientpool. + Field field =3D SocketServerInvoker.class.getDeclaredField("threadpo= ol"); + field.setAccessible(true); + List threadpool =3D (List) field.get(connector.getServerInvoker()); + field =3D SocketServerInvoker.class.getDeclaredField("clientpool"); + field.setAccessible(true); + LRUPool clientpool =3D (LRUPool) field.get(connector.getServerInvoke= r()); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + Thread.sleep(2000); + = + // Create 5 connections. + for (int i =3D 0; i < 5; i++) + { + client.invokeOneway("4", null, true); + } + + Thread.sleep(2000); // time =3D 4000 + assertEquals(0, threadpool.size()); + assertEquals(5, clientpool.size()); + = + // ServerThreads should be back in threadpool at 6000. + client.disconnect(); + Thread.sleep(4000); // time =3D 8000 + assertEquals(5, threadpool.size()); + assertEquals(0, clientpool.size()); + = + // Wait until IdleTimerTask runs at 10000. + Thread.sleep(4000); // time =3D 12000 + = + for (int i =3D 0; i < 6; i++) + { + client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("i =3D " + i); + client.invoke("1"); + client.disconnect(); + } + = + // Time =3D 18000. IdleTimerTask will run at 20000, at which point + // all but one ServerThread should be removed from threadpool. + Thread.sleep(4000); // time =3D 22000 + assertEquals(1, threadpool.size()); + = + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + protected String getTransport() + { + return "socket"; + } + = + = + protected void addExtraClientConfig(Map config) {} + protected void addExtraServerConfig(Map config) {} + = + + protected void setupServer() throws Exception + { + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + config.put("idleTimeout", "10"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + Integer.valueOf((String) invocation.getParameter()).intValue(); + Thread.sleep(Integer.valueOf((String) invocation.getParameter()).= intValue() * 1000); + log.info("parameter: " + invocation.getParameter()); + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } +} \ No newline at end of file Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/socket/idle/ThreadPoolStackTestCase.java ___________________________________________________________________ Added: svn:executable + * --===============2145410814023623296==-- From jboss-remoting-commits at lists.jboss.org Fri Jun 3 21:56:54 2011 Content-Type: multipart/mixed; boundary="===============0525948748665144915==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6379 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/idle. Date: Fri, 03 Jun 2011 21:56:53 -0400 Message-ID: <201106040156.p541urqt005462@svn01.web.mwc.hst.phx2.redhat.com> --===============0525948748665144915== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2011-06-03 21:56:53 -0400 (Fri, 03 Jun 2011) New Revision: 6379 Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socke= t/idle/ThreadPoolStackTestCase.java Log: JBREM-1293: In last series of invocations, allow time for the one ServerThr= ead in use to return itself to threadpool. Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transpor= t/socket/idle/ThreadPoolStackTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java 2011-06-01 03:41:30 UTC (rev 6378) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java 2011-06-04 01:56:53 UTC (rev 6379) @@ -136,18 +136,19 @@ // Wait until IdleTimerTask runs at 10000. Thread.sleep(4000); // time =3D 12000 = - for (int i =3D 0; i < 6; i++) + for (int i =3D 0; i < 5; i++) { client =3D new Client(clientLocator, clientConfig); client.connect(); log.info("i =3D " + i); client.invoke("1"); client.disconnect(); + Thread.sleep(500); } = - // Time =3D 18000. IdleTimerTask will run at 20000, at which point + // Time =3D 17500. IdleTimerTask will run at 20000, at which point // all but one ServerThread should be removed from threadpool. - Thread.sleep(4000); // time =3D 22000 + Thread.sleep(5000); // time =3D 22500 assertEquals(1, threadpool.size()); = shutdownServer(); --===============0525948748665144915==-- From jboss-remoting-commits at lists.jboss.org Fri Jun 3 21:58:07 2011 Content-Type: multipart/mixed; boundary="===============3842577097217312654==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6380 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/idle. Date: Fri, 03 Jun 2011 21:58:06 -0400 Message-ID: <201106040158.p541w65G005489@svn01.web.mwc.hst.phx2.redhat.com> --===============3842577097217312654== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2011-06-03 21:58:06 -0400 (Fri, 03 Jun 2011) New Revision: 6380 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/idle/ThreadPoolStackTestCase.java Log: JBREM-1293: In last series of invocations, allow time for the one ServerThr= ead in use to return itself to threadpool. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/socket/idle/ThreadPoolStackTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java 2011-06-04 01:56:53 UTC (rev 6379) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java 2011-06-04 01:58:06 UTC (rev 6380) @@ -135,18 +135,19 @@ // Wait until IdleTimerTask runs at 10000. Thread.sleep(4000); // time =3D 12000 = - for (int i =3D 0; i < 6; i++) + for (int i =3D 0; i < 5; i++) { client =3D new Client(clientLocator, clientConfig); client.connect(); log.info("i =3D " + i); client.invoke("1"); client.disconnect(); + Thread.sleep(500); } = - // Time =3D 18000. IdleTimerTask will run at 20000, at which point + // Time =3D 17500. IdleTimerTask will run at 20000, at which point // all but one ServerThread should be removed from threadpool. - Thread.sleep(4000); // time =3D 22000 + Thread.sleep(5000); // time =3D 22500 assertEquals(1, threadpool.size()); = shutdownServer(); --===============3842577097217312654==-- From jboss-remoting-commits at lists.jboss.org Tue Jun 7 20:44:44 2011 Content-Type: multipart/mixed; boundary="===============7629120507823180669==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6381 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/idle. Date: Tue, 07 Jun 2011 20:44:43 -0400 Message-ID: <201106080044.p580ih8N012066@svn01.web.mwc.hst.phx2.redhat.com> --===============7629120507823180669== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2011-06-07 20:44:43 -0400 (Tue, 07 Jun 2011) New Revision: 6381 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/idle/ThreadPoolStackTestCase.java Log: JBREM-1293: Changed Level.TRACE to XLevel.TRACE. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/socket/idle/ThreadPoolStackTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java 2011-06-04 01:58:06 UTC (rev 6380) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java 2011-06-08 00:44:43 UTC (rev 6381) @@ -36,6 +36,7 @@ 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.InvocationRequest; import org.jboss.remoting.InvokerLocator; @@ -75,7 +76,7 @@ if (firstTime) { firstTime =3D false; - Logger.getLogger("org.jboss.remoting").setLevel(Level.TRACE); + Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE); Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; PatternLayout layout =3D new PatternLayout(pattern); --===============7629120507823180669==-- From jboss-remoting-commits at lists.jboss.org Sat Jun 11 14:41:18 2011 Content-Type: multipart/mixed; boundary="===============9033681655539922780==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6382 - remoting2/branches/2.2/src/etc. Date: Sat, 11 Jun 2011 14:41:18 -0400 Message-ID: <201106111841.p5BIfIp0015121@svn01.web.mwc.hst.phx2.redhat.com> --===============9033681655539922780== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2011-06-11 14:41:18 -0400 (Sat, 11 Jun 2011) New Revision: 6382 Added: remoting2/branches/2.2/src/etc/maven_deploy Log: JBREM-1264: Script for releasing to maven repository. Added: remoting2/branches/2.2/src/etc/maven_deploy =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/etc/maven_deploy (re= v 0) +++ remoting2/branches/2.2/src/etc/maven_deploy 2011-06-11 18:41:18 UTC (re= v 6382) @@ -0,0 +1,18 @@ +if [ $# -lt 1 ] +then + echo usage: maven_deploy version + exit +fi + +version=3D$1 +echo version: $version + +cp output/lib/jboss-remoting.jar output/lib/jboss-remoting-${version}.= jar +cp output/lib/jboss-remoting-src.jar output/lib/jboss-remoting-${version}-= sources.jar + +echo mvn deploy:deploy-file -DpomFile=3Dpom.xml -Dfile=3Doutput/lib/jboss-= remoting-${version}.jar -Dpackaging=3Djar -DrepositoryId=3Djboss-releases-r= epository -Durl=3Dhttps://repository.jboss.org/nexus/service/local/staging/= deploy/maven2/ + mvn deploy:deploy-file -DpomFile=3Dpom.xml -Dfile=3Doutput/lib/jboss-= remoting-${version}.jar -Dpackaging=3Djar -DrepositoryId=3Djboss-releases-r= epository -Durl=3Dhttps://repository.jboss.org/nexus/service/local/staging/= deploy/maven2/ + +echo mvn deploy:deploy-file -DpomFile=3Dpom.xml -Dfile=3Doutput/lib/jboss-= remoting-${version}-sources.jar -Dpackaging=3Djava-source -DrepositoryId=3D= jboss-releases-repository -Durl=3Dhttps://repository.jboss.org/nexus/servic= e/local/staging/deploy/maven2/ + mvn deploy:deploy-file -DpomFile=3Dpom.xml -Dfile=3Doutput/lib/jboss-= remoting-${version}-sources.jar -Dpackaging=3Djava-source -DrepositoryId=3D= jboss-releases-repository -Durl=3Dhttps://repository.jboss.org/nexus/servic= e/local/staging/deploy/maven2/ + Property changes on: remoting2/branches/2.2/src/etc/maven_deploy ___________________________________________________________________ Added: svn:executable + * --===============9033681655539922780==-- From jboss-remoting-commits at lists.jboss.org Sat Jun 11 14:43:22 2011 Content-Type: multipart/mixed; boundary="===============7590291378021831011==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6383 - remoting2/branches/2.2. Date: Sat, 11 Jun 2011 14:43:22 -0400 Message-ID: <201106111843.p5BIhMUW015166@svn01.web.mwc.hst.phx2.redhat.com> --===============7590291378021831011== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2011-06-11 14:43:22 -0400 (Sat, 11 Jun 2011) New Revision: 6383 Added: remoting2/branches/2.2/pom.xml Log: JBREM-1264: For releasing to maven repository. Added: remoting2/branches/2.2/pom.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/pom.xml (rev 0) +++ remoting2/branches/2.2/pom.xml 2011-06-11 18:43:22 UTC (rev 6383) @@ -0,0 +1,51 @@ + + + + + 4.0.0 + + JBoss Remoting 2 + JBoss Remoting 2 + + + org.jboss + jboss-parent + 5-beta-5 + + + org.jboss.remoting + jboss-remoting + jar + 2.2.4 + = + + + jboss-releases-repository + JBoss Releases Repository + https://repository.jboss.org/nexus/service/local/staging/dep= loy/maven2/ + + + + --===============7590291378021831011==-- From jboss-remoting-commits at lists.jboss.org Mon Jun 13 11:58:41 2011 Content-Type: multipart/mixed; boundary="===============8173289545556044871==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6384 - remoting2/branches. Date: Mon, 13 Jun 2011 11:58:41 -0400 Message-ID: <201106131558.p5DFwfHd009515@svn01.web.mwc.hst.phx2.redhat.com> --===============8173289545556044871== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jbertram(a)redhat.com Date: 2011-06-13 11:58:41 -0400 (Mon, 13 Jun 2011) New Revision: 6384 Added: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/ Removed: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292/ Log: JBPAPP-6536 --===============8173289545556044871==-- From jboss-remoting-commits at lists.jboss.org Mon Jun 13 12:18:06 2011 Content-Type: multipart/mixed; boundary="===============4646904111562210137==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6385 - in remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293: src/main/org/jboss/remoting/transport/bisocket and 4 other directories. Date: Mon, 13 Jun 2011 12:18:06 -0400 Message-ID: <201106131618.p5DGI6B0017740@svn01.web.mwc.hst.phx2.redhat.com> --===============4646904111562210137== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jbertram(a)redhat.com Date: 2011-06-13 12:18:06 -0400 (Mon, 13 Jun 2011) New Revision: 6385 Added: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remot= ing/transport/socket/idle/ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remot= ing/transport/socket/idle/ThreadPoolStackTestCase.java Removed: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remot= ing/transport/socket/idle/ThreadPoolStackTestCase.java Modified: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remoting/tr= ansport/bisocket/ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remoting/tr= ansport/socket/SocketServerInvoker.java remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remot= ing/transport/bisocket/dos/ Log: JBPAPP-6536 Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBR= EM-1261_JBREM-1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293 ___________________________________________________________________ Modified: svn:mergeinfo - /remoting2/branches/2.2:6177-6178,6226,6253,6261-6263,6266-6267,6271-6= 273,6281-6284,6291-6292,6297,6313-6320,6322-6324 /remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_J= BREM-1280_JBREM-1281_JBREM-1292:6370 + /remoting2/branches/2.2:6177-6178,6226,6253,6261-6263,6266-6267,6271-6= 273,6281-6284,6291-6292,6297,6313-6320,6322-6324,6375-6376,6379 /remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_J= BREM-1280_JBREM-1281_JBREM-1292:6370 Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBR= EM-1261_JBREM-1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org= /jboss/remoting/transport/bisocket ___________________________________________________________________ Modified: svn:mergeinfo - /remoting2/branches/2.2/src/main/org/jboss/remoting/transport/bisocket= :6272-6273 /remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_J= BREM-1280_JBREM-1281_JBREM-1292/src/main/org/jboss/remoting/transport/bisoc= ket:6370 + /remoting2/branches/2.2/src/main/org/jboss/remoting/transport/bisocket= :6272-6273,6375-6376,6379 /remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_J= BREM-1280_JBREM-1281_JBREM-1292/src/main/org/jboss/remoting/transport/bisoc= ket:6370 Modified: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBR= EM-1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remo= ting/transport/socket/SocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remoting/t= ransport/socket/SocketServerInvoker.java 2011-06-13 15:58:41 UTC (rev 6384) +++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remoting/t= ransport/socket/SocketServerInvoker.java 2011-06-13 16:18:06 UTC (rev 6385) @@ -611,7 +611,7 @@ { if(threadpool.size() > 0) { - worker =3D (ServerThread)threadpool.removeFirst(); + worker =3D (ServerThread)threadpool.removeLast(); = if(trace) { log.trace(this + (worker =3D=3D null ? " found = NO threads in threadpool" : " got " + worker + " from threadpool")); } } Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBR= EM-1261_JBREM-1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/or= g/jboss/test/remoting/transport/bisocket/dos ___________________________________________________________________ Modified: svn:mergeinfo - /remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bi= socket/dos:6271 /remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_J= BREM-1280_JBREM-1281_JBREM-1292/src/tests/org/jboss/test/remoting/transport= /bisocket/dos:6370 + /remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bi= socket/dos:6271,6375-6376,6379 /remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_J= BREM-1280_JBREM-1281_JBREM-1292/src/tests/org/jboss/test/remoting/transport= /bisocket/dos:6370 Deleted: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBRE= M-1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test= /remoting/transport/socket/idle/ThreadPoolStackTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java 2011-06-01 03:37:46 UTC (rev 6376) +++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remo= ting/transport/socket/idle/ThreadPoolStackTestCase.java 2011-06-13 16:18:06= UTC (rev 6385) @@ -1,213 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2009, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file 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.test.remoting.transport.socket.idle; - -import java.lang.reflect.Field; -import java.net.InetAddress; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.management.MBeanServer; - -import junit.framework.TestCase; - -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.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.transport.Connector; -import org.jboss.remoting.transport.PortUtil; -import org.jboss.remoting.transport.socket.LRUPool; -import org.jboss.remoting.transport.socket.SocketServerInvoker; - - -/** - * JBREM-1293. - * = - * @author Ron Sigal - * @version $Revision: 1.1 $ - *

- * Copyright May 31, 2011 - */ -public class ThreadPoolStackTestCase extends TestCase -{ - private static Logger log =3D Logger.getLogger(ThreadPoolStackTestCase.= class); - = - private static boolean firstTime =3D true; - = - protected String host; - protected int port; - protected String locatorURI; - protected InvokerLocator serverLocator; - protected Connector connector; - protected TestInvocationHandler invocationHandler; - - = - public void setUp() throws Exception - { - if (firstTime) - { - firstTime =3D false; - Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE); - Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); - String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; - PatternLayout layout =3D new PatternLayout(pattern); - ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); - Logger.getRootLogger().addAppender(consoleAppender); = - } - } - - = - public void tearDown() - { - } - = - = - public void testThreadpoolAsStack() throws Throwable - { - log.info("entering " + getName()); - = - // Start server. - setupServer(); - = - // Get threadpool and clientpool. - Field field =3D SocketServerInvoker.class.getDeclaredField("threadpo= ol"); - field.setAccessible(true); - List threadpool =3D (List) field.get(connector.getServerInvoker()); - field =3D SocketServerInvoker.class.getDeclaredField("clientpool"); - field.setAccessible(true); - LRUPool clientpool =3D (LRUPool) field.get(connector.getServerInvoke= r()); - = - // Create client. - InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); - HashMap clientConfig =3D new HashMap(); - clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); - addExtraClientConfig(clientConfig); - Client client =3D new Client(clientLocator, clientConfig); - client.connect(); - log.info("client is connected"); - = - Thread.sleep(2000); - = - // Create 5 connections. - for (int i =3D 0; i < 5; i++) - { - client.invokeOneway("4", null, true); - } - - Thread.sleep(2000); // time =3D 4000 - assertEquals(0, threadpool.size()); - assertEquals(5, clientpool.size()); - = - // ServerThreads should be back in threadpool at 6000. - client.disconnect(); - Thread.sleep(4000); // time =3D 8000 - assertEquals(5, threadpool.size()); - assertEquals(0, clientpool.size()); - = - // Wait until IdleTimerTask runs at 10000. - Thread.sleep(4000); // time =3D 12000 - = - for (int i =3D 0; i < 6; i++) - { - client =3D new Client(clientLocator, clientConfig); - client.connect(); - log.info("i =3D " + i); - client.invoke("1"); - client.disconnect(); - } - = - // Time =3D 18000. IdleTimerTask will run at 20000, at which point - // all but one ServerThread should be removed from threadpool. - Thread.sleep(4000); // time =3D 22000 - assertEquals(1, threadpool.size()); - = - shutdownServer(); - log.info(getName() + " PASSES"); - } - = - = - protected String getTransport() - { - return "socket"; - } - = - = - protected void addExtraClientConfig(Map config) {} - protected void addExtraServerConfig(Map config) {} - = - - protected void setupServer() throws Exception - { - host =3D InetAddress.getLocalHost().getHostAddress(); - port =3D PortUtil.findFreePort(host); - locatorURI =3D getTransport() + "://" + host + ":" + port; - String metadata =3D System.getProperty("remoting.metadata"); - if (metadata !=3D null) - { - locatorURI +=3D "/?" + metadata; - } - serverLocator =3D new InvokerLocator(locatorURI); - log.info("Starting remoting server with locator uri of: " + locatorU= RI); - HashMap config =3D new HashMap(); - config.put(InvokerLocator.FORCE_REMOTE, "true"); - config.put("idleTimeout", "10"); - addExtraServerConfig(config); - connector =3D new Connector(serverLocator, config); - connector.create(); - invocationHandler =3D new TestInvocationHandler(); - connector.addInvocationHandler("test", invocationHandler); - connector.start(); - } - = - = - protected void shutdownServer() throws Exception - { - if (connector !=3D null) - connector.stop(); - } - = - = - static class TestInvocationHandler implements ServerInvocationHandler - { - public void addListener(InvokerCallbackHandler callbackHandler) {} - public Object invoke(final InvocationRequest invocation) throws Thro= wable - { - Integer.valueOf((String) invocation.getParameter()).intValue(); - Thread.sleep(Integer.valueOf((String) invocation.getParameter()).= intValue() * 1000); - log.info("parameter: " + invocation.getParameter()); - return invocation.getParameter(); - } - public void removeListener(InvokerCallbackHandler callbackHandler) {} - public void setMBeanServer(MBeanServer server) {} - public void setInvoker(ServerInvoker invoker) {} - } -} \ No newline at end of file Copied: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM= -1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/= remoting/transport/socket/idle/ThreadPoolStackTestCase.java (from rev 6376,= remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/= idle/ThreadPoolStackTestCase.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remo= ting/transport/socket/idle/ThreadPoolStackTestCase.java = (rev 0) +++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remo= ting/transport/socket/idle/ThreadPoolStackTestCase.java 2011-06-13 16:18:06= UTC (rev 6385) @@ -0,0 +1,214 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file 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.test.remoting.transport.socket.idle; + +import java.lang.reflect.Field; +import java.net.InetAddress; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.management.MBeanServer; + +import junit.framework.TestCase; + +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.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.transport.Connector; +import org.jboss.remoting.transport.PortUtil; +import org.jboss.remoting.transport.socket.LRUPool; +import org.jboss.remoting.transport.socket.SocketServerInvoker; + + +/** + * JBREM-1293. + * = + * @author Ron Sigal + * @version $Revision: 1.1 $ + *

+ * Copyright May 31, 2011 + */ +public class ThreadPoolStackTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(ThreadPoolStackTestCase.= class); + = + private static boolean firstTime =3D true; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + + = + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testThreadpoolAsStack() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Get threadpool and clientpool. + Field field =3D SocketServerInvoker.class.getDeclaredField("threadpo= ol"); + field.setAccessible(true); + List threadpool =3D (List) field.get(connector.getServerInvoker()); + field =3D SocketServerInvoker.class.getDeclaredField("clientpool"); + field.setAccessible(true); + LRUPool clientpool =3D (LRUPool) field.get(connector.getServerInvoke= r()); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + Thread.sleep(2000); + = + // Create 5 connections. + for (int i =3D 0; i < 5; i++) + { + client.invokeOneway("4", null, true); + } + + Thread.sleep(2000); // time =3D 4000 + assertEquals(0, threadpool.size()); + assertEquals(5, clientpool.size()); + = + // ServerThreads should be back in threadpool at 6000. + client.disconnect(); + Thread.sleep(4000); // time =3D 8000 + assertEquals(5, threadpool.size()); + assertEquals(0, clientpool.size()); + = + // Wait until IdleTimerTask runs at 10000. + Thread.sleep(4000); // time =3D 12000 + = + for (int i =3D 0; i < 5; i++) + { + client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("i =3D " + i); + client.invoke("1"); + client.disconnect(); + Thread.sleep(500); + } + = + // Time =3D 17500. IdleTimerTask will run at 20000, at which point + // all but one ServerThread should be removed from threadpool. + Thread.sleep(5000); // time =3D 22500 + assertEquals(1, threadpool.size()); + = + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + protected String getTransport() + { + return "socket"; + } + = + = + protected void addExtraClientConfig(Map config) {} + protected void addExtraServerConfig(Map config) {} + = + + protected void setupServer() throws Exception + { + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + config.put("idleTimeout", "10"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + Integer.valueOf((String) invocation.getParameter()).intValue(); + Thread.sleep(Integer.valueOf((String) invocation.getParameter()).= intValue() * 1000); + log.info("parameter: " + invocation.getParameter()); + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } +} \ No newline at end of file --===============4646904111562210137==-- From jboss-remoting-commits at lists.jboss.org Mon Jun 20 14:39:35 2011 Content-Type: multipart/mixed; boundary="===============4788502096890040819==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6386 - remoting2/branches. Date: Mon, 20 Jun 2011 14:39:35 -0400 Message-ID: <201106201839.p5KIdZMs024458@svn01.web.mwc.hst.phx2.redhat.com> --===============4788502096890040819== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jbertram(a)redhat.com Date: 2011-06-20 14:39:35 -0400 (Mon, 20 Jun 2011) New Revision: 6386 Added: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/ Log: JBPAPP-6750 --===============4788502096890040819==-- From jboss-remoting-commits at lists.jboss.org Mon Jun 20 15:26:02 2011 Content-Type: multipart/mixed; boundary="===============7304770579317821913==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6387 - in remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293: src/main/org/jboss/remoting and 3 other directories. Date: Mon, 20 Jun 2011 15:26:02 -0400 Message-ID: <201106201926.p5KJQ2KL003339@svn01.web.mwc.hst.phx2.redhat.com> --===============7304770579317821913== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jbertram(a)redhat.com Date: 2011-06-20 15:26:02 -0400 (Mon, 20 Jun 2011) New Revision: 6387 Added: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remot= ing/transport/socket/idle/ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remot= ing/transport/socket/idle/ThreadPoolStackTestCase.java Removed: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remot= ing/transport/socket/idle/ThreadPoolStackTestCase.java Modified: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remoting/Se= rverInvoker.java remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277= _JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remoting/tr= ansport/socket/SocketServerInvoker.java Log: JBPAPP-6750 Property changes on: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBR= EM-1261_JBREM-1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293 ___________________________________________________________________ Modified: svn:mergeinfo - /remoting2/branches/2.2:6177-6178,6226,6253,6261-6263,6266-6267,6271-6= 273,6281-6284,6291-6292,6297,6313-6320,6322-6324 + /remoting2/branches/2.2:6177-6178,6226,6253,6261-6263,6266-6267,6271-6= 273,6281-6284,6291-6292,6297,6313-6320,6322-6324,6373,6375-6376,6379 Modified: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBR= EM-1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remo= ting/ServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remoting/S= erverInvoker.java 2011-06-20 18:39:35 UTC (rev 6386) +++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remoting/S= erverInvoker.java 2011-06-20 19:26:02 UTC (rev 6387) @@ -255,7 +255,7 @@ // to avoid lookup in this common case - TLF protected volatile CallbackContainer singleCallbackContainer; = - protected Map callbackHandlers =3D new HashMap(); + protected Map callbackHandlers =3D new ConcurrentHashMap(); protected Map clientCallbackListener =3D new HashMap(); protected boolean started =3D false; protected ConnectionNotifier connectionNotifier =3D new ConnectionNotif= ier(); @@ -1924,7 +1924,7 @@ { ServerInvokerCallbackHandler callbackHandler =3D null; String id =3D ServerInvokerCallbackHandler.getId(invocation); - synchronized(callbackHandlers) +// synchronized(callbackHandlers) { callbackHandler =3D (ServerInvokerCallbackHandler)callbackHandler= s.get(id); = @@ -1946,7 +1946,7 @@ String id =3D ServerInvokerCallbackHandler.getId(invocation); ServerInvokerCallbackHandler callbackHandler =3D null; = - synchronized(callbackHandlers) +// synchronized(callbackHandlers) { callbackHandler =3D (ServerInvokerCallbackHandler) callbackHandle= rs.remove(id); } Modified: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBR= EM-1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remo= ting/transport/socket/SocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remoting/t= ransport/socket/SocketServerInvoker.java 2011-06-20 18:39:35 UTC (rev 6386) +++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/main/org/jboss/remoting/t= ransport/socket/SocketServerInvoker.java 2011-06-20 19:26:02 UTC (rev 6387) @@ -611,7 +611,7 @@ { if(threadpool.size() > 0) { - worker =3D (ServerThread)threadpool.removeFirst(); + worker =3D (ServerThread)threadpool.removeLast(); = if(trace) { log.trace(this + (worker =3D=3D null ? " found = NO threads in threadpool" : " got " + worker + " from threadpool")); } } Deleted: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBRE= M-1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test= /remoting/transport/socket/idle/ThreadPoolStackTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/idle/ThreadPoolStackTestCase.java 2011-06-01 03:37:46 UTC (rev 6376) +++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remo= ting/transport/socket/idle/ThreadPoolStackTestCase.java 2011-06-20 19:26:02= UTC (rev 6387) @@ -1,213 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2009, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file 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.test.remoting.transport.socket.idle; - -import java.lang.reflect.Field; -import java.net.InetAddress; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.management.MBeanServer; - -import junit.framework.TestCase; - -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.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.transport.Connector; -import org.jboss.remoting.transport.PortUtil; -import org.jboss.remoting.transport.socket.LRUPool; -import org.jboss.remoting.transport.socket.SocketServerInvoker; - - -/** - * JBREM-1293. - * = - * @author Ron Sigal - * @version $Revision: 1.1 $ - *

- * Copyright May 31, 2011 - */ -public class ThreadPoolStackTestCase extends TestCase -{ - private static Logger log =3D Logger.getLogger(ThreadPoolStackTestCase.= class); - = - private static boolean firstTime =3D true; - = - protected String host; - protected int port; - protected String locatorURI; - protected InvokerLocator serverLocator; - protected Connector connector; - protected TestInvocationHandler invocationHandler; - - = - public void setUp() throws Exception - { - if (firstTime) - { - firstTime =3D false; - Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE); - Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); - String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; - PatternLayout layout =3D new PatternLayout(pattern); - ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); - Logger.getRootLogger().addAppender(consoleAppender); = - } - } - - = - public void tearDown() - { - } - = - = - public void testThreadpoolAsStack() throws Throwable - { - log.info("entering " + getName()); - = - // Start server. - setupServer(); - = - // Get threadpool and clientpool. - Field field =3D SocketServerInvoker.class.getDeclaredField("threadpo= ol"); - field.setAccessible(true); - List threadpool =3D (List) field.get(connector.getServerInvoker()); - field =3D SocketServerInvoker.class.getDeclaredField("clientpool"); - field.setAccessible(true); - LRUPool clientpool =3D (LRUPool) field.get(connector.getServerInvoke= r()); - = - // Create client. - InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); - HashMap clientConfig =3D new HashMap(); - clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); - addExtraClientConfig(clientConfig); - Client client =3D new Client(clientLocator, clientConfig); - client.connect(); - log.info("client is connected"); - = - Thread.sleep(2000); - = - // Create 5 connections. - for (int i =3D 0; i < 5; i++) - { - client.invokeOneway("4", null, true); - } - - Thread.sleep(2000); // time =3D 4000 - assertEquals(0, threadpool.size()); - assertEquals(5, clientpool.size()); - = - // ServerThreads should be back in threadpool at 6000. - client.disconnect(); - Thread.sleep(4000); // time =3D 8000 - assertEquals(5, threadpool.size()); - assertEquals(0, clientpool.size()); - = - // Wait until IdleTimerTask runs at 10000. - Thread.sleep(4000); // time =3D 12000 - = - for (int i =3D 0; i < 6; i++) - { - client =3D new Client(clientLocator, clientConfig); - client.connect(); - log.info("i =3D " + i); - client.invoke("1"); - client.disconnect(); - } - = - // Time =3D 18000. IdleTimerTask will run at 20000, at which point - // all but one ServerThread should be removed from threadpool. - Thread.sleep(4000); // time =3D 22000 - assertEquals(1, threadpool.size()); - = - shutdownServer(); - log.info(getName() + " PASSES"); - } - = - = - protected String getTransport() - { - return "socket"; - } - = - = - protected void addExtraClientConfig(Map config) {} - protected void addExtraServerConfig(Map config) {} - = - - protected void setupServer() throws Exception - { - host =3D InetAddress.getLocalHost().getHostAddress(); - port =3D PortUtil.findFreePort(host); - locatorURI =3D getTransport() + "://" + host + ":" + port; - String metadata =3D System.getProperty("remoting.metadata"); - if (metadata !=3D null) - { - locatorURI +=3D "/?" + metadata; - } - serverLocator =3D new InvokerLocator(locatorURI); - log.info("Starting remoting server with locator uri of: " + locatorU= RI); - HashMap config =3D new HashMap(); - config.put(InvokerLocator.FORCE_REMOTE, "true"); - config.put("idleTimeout", "10"); - addExtraServerConfig(config); - connector =3D new Connector(serverLocator, config); - connector.create(); - invocationHandler =3D new TestInvocationHandler(); - connector.addInvocationHandler("test", invocationHandler); - connector.start(); - } - = - = - protected void shutdownServer() throws Exception - { - if (connector !=3D null) - connector.stop(); - } - = - = - static class TestInvocationHandler implements ServerInvocationHandler - { - public void addListener(InvokerCallbackHandler callbackHandler) {} - public Object invoke(final InvocationRequest invocation) throws Thro= wable - { - Integer.valueOf((String) invocation.getParameter()).intValue(); - Thread.sleep(Integer.valueOf((String) invocation.getParameter()).= intValue() * 1000); - log.info("parameter: " + invocation.getParameter()); - return invocation.getParameter(); - } - public void removeListener(InvokerCallbackHandler callbackHandler) {} - public void setMBeanServer(MBeanServer server) {} - public void setInvoker(ServerInvoker invoker) {} - } -} \ No newline at end of file Copied: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM= -1277_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/= remoting/transport/socket/idle/ThreadPoolStackTestCase.java (from rev 6376,= remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/= idle/ThreadPoolStackTestCase.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remo= ting/transport/socket/idle/ThreadPoolStackTestCase.java = (rev 0) +++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-127= 7_JBREM-1280_JBREM-1281_JBREM-1292_JBREM-1293/src/tests/org/jboss/test/remo= ting/transport/socket/idle/ThreadPoolStackTestCase.java 2011-06-20 19:26:02= UTC (rev 6387) @@ -0,0 +1,214 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file 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.test.remoting.transport.socket.idle; + +import java.lang.reflect.Field; +import java.net.InetAddress; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.management.MBeanServer; + +import junit.framework.TestCase; + +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.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.transport.Connector; +import org.jboss.remoting.transport.PortUtil; +import org.jboss.remoting.transport.socket.LRUPool; +import org.jboss.remoting.transport.socket.SocketServerInvoker; + + +/** + * JBREM-1293. + * = + * @author Ron Sigal + * @version $Revision: 1.1 $ + *

+ * Copyright May 31, 2011 + */ +public class ThreadPoolStackTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(ThreadPoolStackTestCase.= class); + = + private static boolean firstTime =3D true; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + + = + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testThreadpoolAsStack() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Get threadpool and clientpool. + Field field =3D SocketServerInvoker.class.getDeclaredField("threadpo= ol"); + field.setAccessible(true); + List threadpool =3D (List) field.get(connector.getServerInvoker()); + field =3D SocketServerInvoker.class.getDeclaredField("clientpool"); + field.setAccessible(true); + LRUPool clientpool =3D (LRUPool) field.get(connector.getServerInvoke= r()); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + Thread.sleep(2000); + = + // Create 5 connections. + for (int i =3D 0; i < 5; i++) + { + client.invokeOneway("4", null, true); + } + + Thread.sleep(2000); // time =3D 4000 + assertEquals(0, threadpool.size()); + assertEquals(5, clientpool.size()); + = + // ServerThreads should be back in threadpool at 6000. + client.disconnect(); + Thread.sleep(4000); // time =3D 8000 + assertEquals(5, threadpool.size()); + assertEquals(0, clientpool.size()); + = + // Wait until IdleTimerTask runs at 10000. + Thread.sleep(4000); // time =3D 12000 + = + for (int i =3D 0; i < 5; i++) + { + client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("i =3D " + i); + client.invoke("1"); + client.disconnect(); + Thread.sleep(500); + } + = + // Time =3D 17500. IdleTimerTask will run at 20000, at which point + // all but one ServerThread should be removed from threadpool. + Thread.sleep(5000); // time =3D 22500 + assertEquals(1, threadpool.size()); + = + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + protected String getTransport() + { + return "socket"; + } + = + = + protected void addExtraClientConfig(Map config) {} + protected void addExtraServerConfig(Map config) {} + = + + protected void setupServer() throws Exception + { + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + config.put("idleTimeout", "10"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + Integer.valueOf((String) invocation.getParameter()).intValue(); + Thread.sleep(Integer.valueOf((String) invocation.getParameter()).= intValue() * 1000); + log.info("parameter: " + invocation.getParameter()); + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } +} \ No newline at end of file --===============7304770579317821913==-- From jboss-remoting-commits at lists.jboss.org Fri Jun 24 17:11:50 2011 Content-Type: multipart/mixed; boundary="===============2082443146894103099==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6388 - remoting2/branches. Date: Fri, 24 Jun 2011 17:11:50 -0400 Message-ID: <201106242111.p5OLBoEl016044@svn01.web.mwc.hst.phx2.redhat.com> --===============2082443146894103099== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jbertram(a)redhat.com Date: 2011-06-24 17:11:49 -0400 (Fri, 24 Jun 2011) New Revision: 6388 Added: remoting2/branches/2.5.3.SP1_JBREM-1245/ Log: JBPAPP-6767 --===============2082443146894103099==-- From jboss-remoting-commits at lists.jboss.org Fri Jun 24 17:22:30 2011 Content-Type: multipart/mixed; boundary="===============2455214328077345907==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6389 - in remoting2/branches/2.5.3.SP1_JBREM-1245: src/tests/org/jboss/test/remoting/transport/http/marshal and 10 other directories. Date: Fri, 24 Jun 2011 17:22:29 -0400 Message-ID: <201106242122.p5OLMT0V016874@svn01.web.mwc.hst.phx2.redhat.com> --===============2455214328077345907== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jbertram(a)redhat.com Date: 2011-06-24 17:22:29 -0400 (Fri, 24 Jun 2011) New Revision: 6389 Added: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/socket/retriable/ remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java Removed: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java Modified: remoting2/branches/2.5.3.SP1_JBREM-1245/ remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/http/marshal/HttpContentTypeTestCase.java remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/servlet/mbeanserver/jboss/MBeanServerJBossTestClient.java remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/servlet/mbeanserver/platform/MBeanServerPlatformTestClient.java remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/servlet/multihome/remoting-servlet-service.xml remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/servlet/nopreservelines/remoting-servlet-service.xml remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/servlet/preservelines/remoting-servlet-service.xml remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/servlet/remoting-servlet-service.xml remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/servlet/ssl/keystore remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/servlet/ssl/remoting-servlet-service.xml remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/servlet/ssl/truststore remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remotin= g/transport/socket/ssl/timeout/SSLSocketWriteTimeoutTestCase.java Log: JBPAPP-6767 Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245 ___________________________________________________________________ Added: svn:mergeinfo + /remoting2/branches/2.x:6108-6110,6112 Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/= jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java ___________________________________________________________________ Deleted: svn:mergeinfo - = Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/= jboss/test/remoting/transport/servlet/mbeanserver/jboss/MBeanServerJBossTes= tClient.java ___________________________________________________________________ Deleted: svn:mergeinfo - = Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/= jboss/test/remoting/transport/servlet/mbeanserver/platform/MBeanServerPlatf= ormTestClient.java ___________________________________________________________________ Deleted: svn:mergeinfo - = Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/= jboss/test/remoting/transport/servlet/multihome/remoting-servlet-service.xml ___________________________________________________________________ Deleted: svn:mergeinfo - = Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/= jboss/test/remoting/transport/servlet/nopreservelines/remoting-servlet-serv= ice.xml ___________________________________________________________________ Deleted: svn:mergeinfo - = Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/= jboss/test/remoting/transport/servlet/preservelines/remoting-servlet-servic= e.xml ___________________________________________________________________ Deleted: svn:mergeinfo - = Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/= jboss/test/remoting/transport/servlet/remoting-servlet-service.xml ___________________________________________________________________ Deleted: svn:mergeinfo - = Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/= jboss/test/remoting/transport/servlet/ssl/keystore ___________________________________________________________________ Deleted: svn:mergeinfo - = Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/= jboss/test/remoting/transport/servlet/ssl/remoting-servlet-service.xml ___________________________________________________________________ Deleted: svn:mergeinfo - = Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/= jboss/test/remoting/transport/servlet/ssl/truststore ___________________________________________________________________ Deleted: svn:mergeinfo - = Deleted: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/r= emoting/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/retriable/SocketGeneralizedExceptionTestCase.java 2010-09-24 01:33:38 UT= C (rev 6110) +++ remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remoti= ng/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java 2011-= 06-24 21:22:29 UTC (rev 6389) @@ -1,341 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2010, 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.test.remoting.transport.socket.retriable; - -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.Socket; -import java.net.UnknownHostException; -import java.util.HashMap; -import java.util.Map; - -import javax.management.MBeanServer; -import javax.net.SocketFactory; -import javax.net.ssl.SSLException; - -import junit.framework.TestCase; - -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.InvocationRequest; -import org.jboss.remoting.InvokerLocator; -import org.jboss.remoting.Remoting; -import org.jboss.remoting.ServerInvocationHandler; -import org.jboss.remoting.ServerInvoker; -import org.jboss.remoting.callback.InvokerCallbackHandler; -import org.jboss.remoting.transport.Connector; -import org.jboss.remoting.transport.PortUtil; - - -/** - * Unit test for JBREM-1245. - * = - * @author Ron Sigal - * @version $Rev$ - *

- * Copyright Sep 22, 2010 - *

- */ -public class SocketGeneralizedExceptionTestCase extends TestCase -{ - private static Logger log =3D Logger.getLogger(SocketGeneralizedExcepti= onTestCase.class); - = - private static boolean firstTime =3D true; - protected static IOException exceptionToThrow; - = - protected String host; - protected int port; - protected String locatorURI; - protected InvokerLocator serverLocator; - protected Connector connector; - protected TestInvocationHandler invocationHandler; - - = - public void setUp() throws Exception - { - if (firstTime) - { - firstTime =3D false; - Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE); - Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); - String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; - PatternLayout layout =3D new PatternLayout(pattern); - ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); - Logger.getRootLogger().addAppender(consoleAppender); = - } - = - TestOutputStream.counter =3D 0; - TestOutputStream.threwException =3D false; - } - - = - public void tearDown() - { - } - = - = - public void testSSLException() throws Throwable - { - log.info("entering " + getName()); - exceptionToThrow =3D new SSLException("Connection has been shutdown"= ); - doTest(); - log.info(getName() + " PASSES"); - } - = - = - public void testConnectionResetException() throws Throwable - { - log.info("entering " + getName()); - exceptionToThrow =3D new IOException("Connection reset by peer"); - doTest(); - log.info(getName() + " PASSES"); - } - = - - public void testConnectionClosedException() throws Throwable - { - log.info("entering " + getName()); - exceptionToThrow =3D new IOException("Connection is closed"); - doTest(); - log.info(getName() + " PASSES"); - } - = - - public void testBrokenPipeException() throws Throwable - { - log.info("entering " + getName()); - exceptionToThrow =3D new IOException("Broken pipe"); - doTest(); - log.info(getName() + " PASSES"); - } - = - = - protected void doTest() throws Throwable - { - // Start server. - setupServer(); - = - // Create client. - InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); - HashMap clientConfig =3D new HashMap(); - clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); - clientConfig.put(Remoting.CUSTOM_SOCKET_FACTORY, new TestSocketFacto= ry(2)); - addExtraClientConfig(clientConfig); - Client client =3D new Client(clientLocator, clientConfig); - client.connect(); - log.info("client is connected"); - = - // Verify invocation works in spite of exception. - assertEquals("xyz", client.invoke("xyz")); - assertTrue(TestOutputStream.threwException); - = - client.disconnect(); - shutdownServer(); = - } - = - = - protected String getTransport() - { - return "socket"; - } - = - protected void addExtraServerConfig(Map config) {} - protected void addExtraClientConfig(Map config) {} - = - - protected void setupServer() throws Exception - { - host =3D InetAddress.getLocalHost().getHostAddress(); - port =3D PortUtil.findFreePort(host); - locatorURI =3D getTransport() + "://" + host + ":" + port + "/?gener= alizeSocketException=3Dtrue"; - String metadata =3D System.getProperty("remoting.metadata"); - if (metadata !=3D null) - { - locatorURI +=3D "&" + metadata; - } - serverLocator =3D new InvokerLocator(locatorURI); - log.info("Starting remoting server with locator uri of: " + locatorU= RI); - HashMap config =3D new HashMap(); - config.put(InvokerLocator.FORCE_REMOTE, "true"); - addExtraServerConfig(config); - connector =3D new Connector(serverLocator, config); - connector.create(); - invocationHandler =3D new TestInvocationHandler(); - connector.addInvocationHandler("test", invocationHandler); - connector.start(); - } - = - = - protected void shutdownServer() throws Exception - { - if (connector !=3D null) - connector.stop(); - } - = - = - static class TestInvocationHandler implements ServerInvocationHandler - { - public void addListener(InvokerCallbackHandler callbackHandler) {} - public Object invoke(final InvocationRequest invocation) throws Thro= wable - { - return invocation.getParameter(); - } - public void removeListener(InvokerCallbackHandler callbackHandler) {} - public void setMBeanServer(MBeanServer server) {} - public void setInvoker(ServerInvoker invoker) {} - } - = - = - public static class TestSocketFactory extends SocketFactory - { - int initialSuccesses =3D 1; - - public TestSocketFactory() - { - } - public TestSocketFactory(int initialSuccesses) - { - this.initialSuccesses =3D initialSuccesses; - } - public Socket createSocket() - { - Socket s =3D new TestSocket(initialSuccesses); - log.info("returning " + s); - return s; - } - public Socket createSocket(String arg0, int arg1) throws IOException= , UnknownHostException - { - Socket s =3D new TestSocket(arg0, arg1, initialSuccesses); - log.info("returning " + s); - return s; - } - - public Socket createSocket(InetAddress arg0, int arg1) throws IOExce= ption - { - Socket s =3D new TestSocket(arg0, arg1, initialSuccesses); - log.info("returning " + s); - return s; - } - - public Socket createSocket(String arg0, int arg1, InetAddress arg2, = int arg3) throws IOException, UnknownHostException - { - Socket s =3D new TestSocket(arg0, arg1, arg2, arg3, initialSucces= ses); - log.info("returning " + s); - return s; - } - - public Socket createSocket(InetAddress arg0, int arg1, InetAddress a= rg2, int arg3) throws IOException - { - Socket s =3D new TestSocket(arg0, arg1, arg2, arg3, initialSucces= ses); - log.info("returning " + s); - return s; - } - } - = - = - static class TestSocket extends Socket - { - int initialSuccesses; - = - public TestSocket(int initialWrites) - { - this.initialSuccesses =3D initialWrites; - } - public TestSocket(String host, int port, int initialWrites) throws U= nknownHostException, IOException - { - super(host, port); - this.initialSuccesses =3D initialWrites; - } - public TestSocket(InetAddress address, int port, int initialWrites) = throws IOException - { - super(address, port); - this.initialSuccesses =3D initialWrites; - } - public TestSocket(String host, int port, InetAddress localAddr, int = localPort, int initialWrites) throws IOException - { - super(host, port, localAddr, localPort); - this.initialSuccesses =3D initialWrites; - } - public TestSocket(InetAddress address, int port, InetAddress localAd= dr, int localPort, int initialWrites) throws IOException - { - super(address, port, localAddr, localPort); - this.initialSuccesses =3D initialWrites; - } - public OutputStream getOutputStream() throws IOException - { - return new TestOutputStream(super.getOutputStream(), initialSucce= sses); - } - public String toString() - { - return "TestSocket[" + getLocalPort() + "->" + getPort() + "]"; - } - } - = - = - static class TestOutputStream extends OutputStream - { - public static int counter; - public static boolean threwException; - = - OutputStream os; - boolean closed; - int initialWrites; - boolean doThrow =3D true; - = - public TestOutputStream(OutputStream os, int initialWrites) - { - this.os =3D os; - this.initialWrites =3D initialWrites; - } - public void write(int b) throws IOException - { - if (doThrow && ++counter =3D=3D initialWrites) - { - log.info("throwing " + exceptionToThrow); - threwException =3D true; - throw exceptionToThrow; - } - os.write(b); - } - public void write(byte b[], int off, int len) throws IOException - { - log.info("TestOutputStream: counter =3D " + (counter + 1) + ", in= itialWrites =3D " + initialWrites); - if (++counter =3D=3D initialWrites) - { - log.info("throwing " + exceptionToThrow); - threwException =3D true; - throw exceptionToThrow; - } - log.info(this + " calling write()"); - doThrow =3D false; - os.write(b, off, len); - os.flush(); - doThrow =3D true; - log.info(this + " back from write()"); - } - } -} \ No newline at end of file Copied: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/re= moting/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java (= from rev 6110, remoting2/branches/2.x/src/tests/org/jboss/test/remoting/tra= nsport/socket/retriable/SocketGeneralizedExceptionTestCase.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remoti= ng/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java = (rev 0) +++ remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/jboss/test/remoti= ng/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java 2011-= 06-24 21:22:29 UTC (rev 6389) @@ -0,0 +1,341 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, 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.test.remoting.transport.socket.retriable; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.Socket; +import java.net.UnknownHostException; +import java.util.HashMap; +import java.util.Map; + +import javax.management.MBeanServer; +import javax.net.SocketFactory; +import javax.net.ssl.SSLException; + +import junit.framework.TestCase; + +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.InvocationRequest; +import org.jboss.remoting.InvokerLocator; +import org.jboss.remoting.Remoting; +import org.jboss.remoting.ServerInvocationHandler; +import org.jboss.remoting.ServerInvoker; +import org.jboss.remoting.callback.InvokerCallbackHandler; +import org.jboss.remoting.transport.Connector; +import org.jboss.remoting.transport.PortUtil; + + +/** + * Unit test for JBREM-1245. + * = + * @author Ron Sigal + * @version $Rev$ + *

+ * Copyright Sep 22, 2010 + *

+ */ +public class SocketGeneralizedExceptionTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(SocketGeneralizedExcepti= onTestCase.class); + = + private static boolean firstTime =3D true; + protected static IOException exceptionToThrow; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + + = + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + = + TestOutputStream.counter =3D 0; + TestOutputStream.threwException =3D false; + } + + = + public void tearDown() + { + } + = + = + public void testSSLException() throws Throwable + { + log.info("entering " + getName()); + exceptionToThrow =3D new SSLException("Connection has been shutdown"= ); + doTest(); + log.info(getName() + " PASSES"); + } + = + = + public void testConnectionResetException() throws Throwable + { + log.info("entering " + getName()); + exceptionToThrow =3D new IOException("Connection reset by peer"); + doTest(); + log.info(getName() + " PASSES"); + } + = + + public void testConnectionClosedException() throws Throwable + { + log.info("entering " + getName()); + exceptionToThrow =3D new IOException("Connection is closed"); + doTest(); + log.info(getName() + " PASSES"); + } + = + + public void testBrokenPipeException() throws Throwable + { + log.info("entering " + getName()); + exceptionToThrow =3D new IOException("Broken pipe"); + doTest(); + log.info(getName() + " PASSES"); + } + = + = + protected void doTest() throws Throwable + { + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Remoting.CUSTOM_SOCKET_FACTORY, new TestSocketFacto= ry(2)); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Verify invocation works in spite of exception. + assertEquals("xyz", client.invoke("xyz")); + assertTrue(TestOutputStream.threwException); + = + client.disconnect(); + shutdownServer(); = + } + = + = + protected String getTransport() + { + return "socket"; + } + = + protected void addExtraServerConfig(Map config) {} + protected void addExtraClientConfig(Map config) {} + = + + protected void setupServer() throws Exception + { + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port + "/?gener= alizeSocketException=3Dtrue"; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "&" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } + = + = + public static class TestSocketFactory extends SocketFactory + { + int initialSuccesses =3D 1; + + public TestSocketFactory() + { + } + public TestSocketFactory(int initialSuccesses) + { + this.initialSuccesses =3D initialSuccesses; + } + public Socket createSocket() + { + Socket s =3D new TestSocket(initialSuccesses); + log.info("returning " + s); + return s; + } + public Socket createSocket(String arg0, int arg1) throws IOException= , UnknownHostException + { + Socket s =3D new TestSocket(arg0, arg1, initialSuccesses); + log.info("returning " + s); + return s; + } + + public Socket createSocket(InetAddress arg0, int arg1) throws IOExce= ption + { + Socket s =3D new TestSocket(arg0, arg1, initialSuccesses); + log.info("returning " + s); + return s; + } + + public Socket createSocket(String arg0, int arg1, InetAddress arg2, = int arg3) throws IOException, UnknownHostException + { + Socket s =3D new TestSocket(arg0, arg1, arg2, arg3, initialSucces= ses); + log.info("returning " + s); + return s; + } + + public Socket createSocket(InetAddress arg0, int arg1, InetAddress a= rg2, int arg3) throws IOException + { + Socket s =3D new TestSocket(arg0, arg1, arg2, arg3, initialSucces= ses); + log.info("returning " + s); + return s; + } + } + = + = + static class TestSocket extends Socket + { + int initialSuccesses; + = + public TestSocket(int initialWrites) + { + this.initialSuccesses =3D initialWrites; + } + public TestSocket(String host, int port, int initialWrites) throws U= nknownHostException, IOException + { + super(host, port); + this.initialSuccesses =3D initialWrites; + } + public TestSocket(InetAddress address, int port, int initialWrites) = throws IOException + { + super(address, port); + this.initialSuccesses =3D initialWrites; + } + public TestSocket(String host, int port, InetAddress localAddr, int = localPort, int initialWrites) throws IOException + { + super(host, port, localAddr, localPort); + this.initialSuccesses =3D initialWrites; + } + public TestSocket(InetAddress address, int port, InetAddress localAd= dr, int localPort, int initialWrites) throws IOException + { + super(address, port, localAddr, localPort); + this.initialSuccesses =3D initialWrites; + } + public OutputStream getOutputStream() throws IOException + { + return new TestOutputStream(super.getOutputStream(), initialSucce= sses); + } + public String toString() + { + return "TestSocket[" + getLocalPort() + "->" + getPort() + "]"; + } + } + = + = + static class TestOutputStream extends OutputStream + { + public static int counter; + public static boolean threwException; + = + OutputStream os; + boolean closed; + int initialWrites; + boolean doThrow =3D true; + = + public TestOutputStream(OutputStream os, int initialWrites) + { + this.os =3D os; + this.initialWrites =3D initialWrites; + } + public void write(int b) throws IOException + { + if (doThrow && ++counter =3D=3D initialWrites) + { + log.info("throwing " + exceptionToThrow); + threwException =3D true; + throw exceptionToThrow; + } + os.write(b); + } + public void write(byte b[], int off, int len) throws IOException + { + log.info("TestOutputStream: counter =3D " + (counter + 1) + ", in= itialWrites =3D " + initialWrites); + if (++counter =3D=3D initialWrites) + { + log.info("throwing " + exceptionToThrow); + threwException =3D true; + throw exceptionToThrow; + } + log.info(this + " calling write()"); + doThrow =3D false; + os.write(b, off, len); + os.flush(); + doThrow =3D true; + log.info(this + " back from write()"); + } + } +} \ No newline at end of file Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245/src/tests/org/= jboss/test/remoting/transport/socket/ssl/timeout/SSLSocketWriteTimeoutTestC= ase.java ___________________________________________________________________ Deleted: svn:mergeinfo - = --===============2455214328077345907==-- From jboss-remoting-commits at lists.jboss.org Fri Jun 24 17:24:52 2011 Content-Type: multipart/mixed; boundary="===============3876541801622765556==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6390 - in remoting2/branches/2.5.3.SP1_JBREM-1245: src/main/org/jboss/remoting/transport/socket and 1 other directory. Date: Fri, 24 Jun 2011 17:24:52 -0400 Message-ID: <201106242124.p5OLOqiZ016901@svn01.web.mwc.hst.phx2.redhat.com> --===============3876541801622765556== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jbertram(a)redhat.com Date: 2011-06-24 17:24:52 -0400 (Fri, 24 Jun 2011) New Revision: 6390 Modified: remoting2/branches/2.5.3.SP1_JBREM-1245/ remoting2/branches/2.5.3.SP1_JBREM-1245/src/main/org/jboss/remoting/tran= sport/socket/MicroSocketClientInvoker.java Log: JBPAPP-6767 Property changes on: remoting2/branches/2.5.3.SP1_JBREM-1245 ___________________________________________________________________ Modified: svn:mergeinfo - /remoting2/branches/2.x:6108-6110,6112 + /remoting2/branches/2.x:6107-6110,6112 Modified: remoting2/branches/2.5.3.SP1_JBREM-1245/src/main/org/jboss/remoti= ng/transport/socket/MicroSocketClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.5.3.SP1_JBREM-1245/src/main/org/jboss/remoting/tra= nsport/socket/MicroSocketClientInvoker.java 2011-06-24 21:22:29 UTC (rev 63= 89) +++ remoting2/branches/2.5.3.SP1_JBREM-1245/src/main/org/jboss/remoting/tra= nsport/socket/MicroSocketClientInvoker.java 2011-06-24 21:24:52 UTC (rev 63= 90) @@ -139,7 +139,7 @@ public static long serializeTime =3D 0; public static long deserializeTime =3D 0; = - private static final String patternString =3D "^.*(?:connection.*reset|= connection.*closed|broken.*pipe).*$"; + private static final String patternString =3D "^.*(?:connection.*reset|= connection.*closed|broken.*pipe|connection.*shutdown).*$"; private static final Pattern RETRIABLE_ERROR_MESSAGE =3D Pattern.compil= e(patternString, Pattern.CASE_INSENSITIVE); = /** --===============3876541801622765556==--