JBoss Remoting SVN: r6332 - remoting2/branches/2.2/lib/jbossweb.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2011-04-18 23:12:07 -0400 (Mon, 18 Apr 2011)
New Revision: 6332
Modified:
remoting2/branches/2.2/lib/jbossweb/README
Log:
JBREM-1280: Switched from tomcat to jbossweb.
Modified: remoting2/branches/2.2/lib/jbossweb/README
===================================================================
--- remoting2/branches/2.2/lib/jbossweb/README 2011-04-18 20:30:16 UTC (rev 6331)
+++ remoting2/branches/2.2/lib/jbossweb/README 2011-04-19 03:12:07 UTC (rev 6332)
@@ -0,0 +1 @@
+The version of jbossweb.jar in this directory is 2.0.0.GA_CP15-brew, which ships with EAP 4.3.0.GA.CP09.
\ No newline at end of file
13 years, 7 months
JBoss Remoting SVN: r6331 - remoting2/branches.
by jboss-remoting-commits@lists.jboss.org
Author: jbertram(a)redhat.com
Date: 2011-04-18 16:30:16 -0400 (Mon, 18 Apr 2011)
New Revision: 6331
Added:
remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/
Log:
JBPAPP-6353
13 years, 7 months
JBoss Remoting SVN: r6330 - in remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281: docs/guide/en and 21 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: jbertram(a)redhat.com
Date: 2011-04-18 16:23:14 -0400 (Mon, 18 Apr 2011)
New Revision: 6330
Added:
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/jbossweb/
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/jbossweb/README
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/jbossweb/jbossweb.jar
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java
Removed:
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/apache-tomcat/
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/jbossweb/jbossweb.jar
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java
Modified:
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/build.xml
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/docs/guide/en/chap5.xml
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/ssl/RemotingSSLImplementation.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/connection/params/ConnectionValidatorConfigurationTestCase.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/ServletConfigurationMapTestClient.java
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF/
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/remoting-servlet-service.xml
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/remoting-servlet-service.xml
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/keystore
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/remoting-sslservlet-service.xml
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/truststore
Log:
JBPAPP-6352
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281
___________________________________________________________________
Added: svn:mergeinfo
+ /remoting2/branches/2.2:6177-6178,6226,6253,6266-6267,6271-6273,6281-6284,6291-6292,6297,6313-6320,6322-6324
Modified: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/build.xml
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/build.xml 2011-04-18 19:53:41 UTC (rev 6329)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/build.xml 2011-04-18 20:23:14 UTC (rev 6330)
@@ -142,7 +142,7 @@
<!-- Compile -->
<!-- ================================================================== -->
<target name="compile" description="Compile all source files." depends="configure">
-
+ <echo>${java.runtime.version}</echo>
<mkdir dir="${compile.dir}"/>
<!-- java source compile -->
@@ -153,8 +153,19 @@
deprecation="on"
optimize="off"
includes="**/*.java"
- failonerror="true">
+ failonerror="true"
+ sourcepath="">
<src path="${src.dir}"/>
+ <exclude name="org/jboss/remoting/transport/coyote/**" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/http/HTTPServerInvoker.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/http/TransportServerFactory.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/http/ssl/HTTPSServerInvoker.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/https/HTTPSServerInvoker.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/https/TransportServerFactory.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/servlet/ServletServerInvoker.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/servlet/TransportServerFactory.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/sslservlet/TransportServerFactory.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/web/WebServerInvoker.java" if="isJDK4"/>
<classpath refid="library.classpath"/>
</javac>
@@ -241,6 +252,13 @@
includes="**/*.java"
failonerror="true">
<src path="${tests.src.dir}"/>
+ <include name="**/*.java"/>
+ <exclude name="org/jboss/test/remoting/**/coyote/**" if="isJDK4"/>
+ <exclude name="org/jboss/test/remoting/**/http/**" if="isJDK4"/>
+ <exclude name="org/jboss/test/remoting/**/*HTTP*" if="isJDK4"/>
+ <exclude name="org/jboss/test/remoting/**/*Http*" if="isJDK4"/>
+ <exclude name="org/jboss/test/remoting/**/https/**" if="isJDK4"/>
+ <exclude name="org/jboss/test/remoting/**/servlet/**" if="isJDK4"/>
<classpath refid="tests.classpath"/>
</javac>
@@ -596,7 +614,9 @@
<target name="tests.functional.core" depends="configure">
<antcall target="tests.functional.serialization.java.core" inheritrefs="true"/>
+ <antcall target="tests.functional.serialization.java.http.core" inheritrefs="true"/>
<antcall target="tests.functional.serialization.jboss.core" inheritrefs="true"/>
+ <antcall target="tests.functional.serialization.jboss.http.core" inheritrefs="true"/>
</target>
<!-- calls functional main tests and marshall test with both java and jboss (if jdk1.5) serialization -->
@@ -722,6 +742,7 @@
</target>
<target name="tests.functional.main.core" depends="tests.jars">
+ <echo>bisocket/rmi/socket: ${metadata}</echo>
<mkdir dir="${output.tests.results}"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
@@ -737,6 +758,12 @@
haltonfailure="no">
<fileset dir="${tests.compile.dir}">
<include name="**/remoting/**/*TestCase.class"/>
+ <exclude name="**/remoting/**/coyote/**/*TestCase.class"/>
+ <exclude name="**/remoting/**/coyote/**/*oyot*TestCase.class"/>
+ <exclude name="**/remoting/**/http/**/*TestCase.class"/>
+ <exclude name="**/remoting/**/*HTTP*TestCase.class"/>
+ <exclude name="**/remoting/**/*Http*TestCase.class"/>
+ <exclude name="**/remoting/**/*http*TestCase.class"/>
<exclude name="**/remoting/**/ServerBindingTestCase.class"/>
<exclude name="**/remoting/marshall/dynamic/remote/**/*TestCase.class"/>
<exclude name="**/remoting/serialization/**/jboss/*TestCase.class"/>
@@ -758,6 +785,73 @@
</batchtest>
</junit>
</target>
+
+ <target name="tests.functional.serialization.java.http.core" unless="isJDK4">
+ <antcall target="tests.functional.http.jbossweb.core" inheritrefs="true">
+ <param name="serialization" value="java"/>
+ </antcall>
+ </target>
+
+ <target name="tests.functional.serialization.jboss.http.core" unless="isJDK4">
+ <antcall target="tests.functional.http.jbossweb.core" inheritrefs="true">
+ <param name="serialization" value="jboss"/>
+ </antcall>
+ </target>
+
+ <target name="tests.functional.http.jbossweb.core" unless="isJDK4">
+ <antcall target="tests.functional.main.http.core" inheritrefs="true">
+ <param name="remoting.metadata.key" value="remoting.metadata"/>
+ <param name="metadata" value="serializationtype=${serialization}"/>
+ <param name="jboss-junit-configuration" value="${serialization}_serialization_jbossweb"/>
+ <param name="classpath" value="tests.classpath"/>
+ <param name="version" value="jbossweb"/>
+ </antcall>
+ </target>
+
+ <target name="tests.functional.main.http.core">
+ <mkdir dir="${output.tests.results}"/>
+ <echo>http with ${version}: ${metadata}</echo>
+ <junit printsummary="true" fork="yes" includeantruntime="true" maxmemory="1024m">
+ <jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
+ <jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
+ <classpath>
+ <path refid="${classpath}"/>
+ <pathelement location="${output.lib.dir}/jboss-remoting-tests.jar"/>
+ </classpath>
+ <!-- set system properties required by JRunit -->
+ <sysproperty key="jrunit.bind_addr" value="${bind.address}"/>
+ <sysproperty key="jrunit.mcast_addr" value="${multicast.address}"/>
+ <sysproperty key="jrunit.mcast_port" value="${multicast.port}"/>
+ <sysproperty key="jrunit.receive_on_all_interfaces" value="${receiveOnAllInterfaces}"/>
+ <sysproperty key="jrunit.send_on_all_interfaces" value="${sendOnAllInterfaces}"/>
+ <sysproperty key="jrunit.send_interfaces" value="${sendInterfaces}"/>
+ <sysproperty key="jrunit.logdir" value="${output.tests}"/>
+ <sysproperty key="remoting.jar.dir" value="${basedir}/output/lib"/>
+ <sysproperty key="ant.library.dir" value="${ant.library.dir}"/>
+ <sysproperty key="build.home" value="${basedir}"/>
+ <sysproperty key="jboss-junit-configuration" value="${jboss-junit-configuration}"/>
+ <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+ extension="-${jboss-junit-configuration}.xml"/>
+ <batchtest fork="yes" todir="${output.tests.results}"
+ haltonfailure="no">
+ <fileset dir="${tests.compile.dir}">
+ <include name="**/remoting/**/coyote/**/*TestCase.class"/>
+ <include name="**/remoting/**/coyote/**/*oyot*TestCase.class"/>
+ <include name="**/remoting/**/http/**/*TestCase.class"/>
+ <include name="**/remoting/**/*HTTP*TestCase.class"/>
+ <include name="**/remoting/**/*Http*TestCase.class"/>
+ <include name="**/remoting/**/*http*TestCase.class"/>
+ <exclude name="**/remoting/**/HTTPSAsynchCallbackTestCase.class"/>
+ <exclude name="**/remoting/**/HTTPInvokerClientTestCase.class"/>
+ <exclude name="**/remoting/transport/http/compression/*CompressedHTTPInvokerTestCase*"/>
+ <exclude name="**/remoting/**/performance/**"/>
+ <exclude name="**/remoting/**/nonserializable/**"/>
+ <exclude name="**/remoting/marshall/dynamic/remote/**/*TestCase.class"/>
+ <exclude name="**/remoting/versioning/**/*TestCase.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
<target name="tests.functional.main.isJDK5" depends="tests.jars" if="isJDK5">
<mkdir dir="${output.tests.results}"/>
@@ -869,8 +963,14 @@
<!-- check to see if running jdk1.5 -->
<target name="get-jvm">
<condition property="isJDK5">
- <equals arg1="${ant.java.version}" arg2="1.5"/>
+ <or>
+ <equals arg1="${ant.java.version}" arg2="1.5"/>
+ <equals arg1="${ant.java.version}" arg2="1.6"/>
+ </or>
</condition>
+ <condition property="isJDK4">
+ <contains string="${java.runtime.version}" substring="1.4"/>
+ </condition>
</target>
<!-- This section is for quick smoke test of java vs. jboss serialization -->
@@ -1370,6 +1470,87 @@
</antcall>
<!-- ******************************************************************************** -->
+ <!-- Current <- -> 2.2.3.SP3 -->
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP3-client"/>
+ <param name="client.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP3/jboss-remoting.jar"/>
+ <param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value=""/>
+ <param name="server.version" value="2"/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="false"/>
+ <param name="serverImplementsServerIdentity" value="true"/>
+ </antcall>
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP3-server"/>
+ <param name="server.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP3/jboss-remoting.jar"/>
+ <param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value="2"/>
+ <param name="server.version" value=""/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="true"/>
+ <param name="serverImplementsServerIdentity" value="false"/>
+ </antcall>
+
+ <!-- ******************************************************************************** -->
+ <!-- Current <- -> 2.2.3.SP2 -->
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP2-client"/>
+ <param name="client.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP2/jboss-remoting.jar"/>
+ <param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value=""/>
+ <param name="server.version" value="2"/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="false"/>
+ <param name="serverImplementsServerIdentity" value="true"/>
+ </antcall>
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP2-server"/>
+ <param name="server.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP2/jboss-remoting.jar"/>
+ <param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value="2"/>
+ <param name="server.version" value=""/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="true"/>
+ <param name="serverImplementsServerIdentity" value="false"/>
+ </antcall>
+
+ <!-- ******************************************************************************** -->
+ <!-- Current <- -> 2.2.3.SP1 -->
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP1-client"/>
+ <param name="client.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP1/jboss-remoting.jar"/>
+ <param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value=""/>
+ <param name="server.version" value="2"/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="false"/>
+ <param name="serverImplementsServerIdentity" value="true"/>
+ </antcall>
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP1-server"/>
+ <param name="server.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP1/jboss-remoting.jar"/>
+ <param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value="2"/>
+ <param name="server.version" value=""/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="true"/>
+ <param name="serverImplementsServerIdentity" value="false"/>
+ </antcall>
+
+ <!-- ******************************************************************************** -->
<!-- Current <- -> 2.2.3 -->
<antcall target="tests.versioning.all_transports" inheritrefs="true">
<param name="jboss-junit-configuration" value="2_2_3-client"/>
Modified: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/docs/guide/en/chap5.xml
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/docs/guide/en/chap5.xml 2011-04-18 19:53:41 UTC (rev 6329)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/docs/guide/en/chap5.xml 2011-04-18 20:23:14 UTC (rev 6330)
@@ -1078,6 +1078,16 @@
<classname>java.net.SocketTimeoutException</classname>. If set to "true",
or if JBossSerialization is being used, the server thread will continue to wait for an invocation; otherwise, it
will return itself to the thread pool.</para>
+
+
+ <para><emphasis role="bold">acceptThreadPriorityIncrement</emphasis> - can
+ be used to increment the priority of the accept thread, which manages the
+ <classname>ServerSocket</classname>. The value is added to
+ <code>java.lang.Thread.NORM_PRIORITY</code>, and the resulting value must be
+ no more than <code>java.lang.Thread.MAX_PRIORITY</code>. This parameter might
+ be useful on a heavily loaded machine if the accept
+ thread is getting starved.
+ </para>
<bridgehead>Configurations affecting the Socket invoker
client</bridgehead>
@@ -2838,6 +2848,18 @@
<classname>BisocketServerInvoker</classname> uses it to govern the
number of attempts it should make to create both ordinary and control
sockets. The default value is 10. </para>
+
+
+ <para>Also, the parameter "acceptThreadPriorityIncrement", inherited from
+ <classname>org.jboss.remoting.transport.socket.SocketServerInvoker</classname>, can
+ be used to increment the priority of the thread that manages the secondary
+ <classname>ServerSocket</classname>. The value is added to
+ <code>java.lang.Thread.NORM_PRIORITY</code>, and the resulting value must be
+ no more than <code>java.lang.Thread.MAX_PRIORITY</code>. This parameter might
+ be useful on a heavily loaded machine if the secondary <classname>ServerSocket</classname>
+ thread is getting starved.
+ </para>
+
</section>
<section>
@@ -6805,6 +6827,18 @@
value is 'serverSocketClass') - specifies the fully qualified class name
for the custom SocketWrapper implementation to use on the server.</para>
+
+ <para><emphasis role="bold">Bean properties (meaning have getter/setter):</emphasis></para>
+
+ <para><emphasis role="bold">acceptThreadPriorityIncrement</emphasis> - can
+ be used to increment the priority of the accept thread, which manages the
+ <classname>ServerSocket</classname>. The value is added to
+ <code>java.lang.Thread.NORM_PRIORITY</code>, and the resulting value must be
+ no more than <code>java.lang.Thread.MAX_PRIORITY</code>. This parameter might
+ be useful on a heavily loaded machine if the accept
+ thread is getting starved.
+ </para>
+
<bridgehead>org.jboss.remoting.transport.socket.SocketWrapper</bridgehead>
<para><emphasis role="bold">WRITE_TIMEOUT</emphasis> (actual value
Copied: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/jbossweb/README (from rev 6322, remoting2/branches/2.2/lib/jbossweb/README)
===================================================================
Deleted: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/jbossweb/jbossweb.jar
===================================================================
(Binary files differ)
Copied: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/jbossweb/jbossweb.jar (from rev 6318, remoting2/branches/2.2/lib/jbossweb/jbossweb.jar)
===================================================================
(Binary files differ)
Modified: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2011-04-18 19:53:41 UTC (rev 6329)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -653,9 +653,6 @@
protected LeasePinger getLeasePinger()
{
- synchronized(clientLeaseLock)
- {
- return leasePinger;
- }
+ return leasePinger;
}
}
Modified: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java 2011-04-18 19:53:41 UTC (rev 6329)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -76,4 +76,13 @@
*/
public static final String SECONDARY_BIND_PORT = "secondaryBindPort";
public static final String SECONDARY_CONNECT_PORT = "secondaryConnectPort";
+
+ /**
+ * Configuration keys and default values for parameters related to DOS attack
+ * on BisocketServerInvoker.SecondaryServerSocketThread
+ */
+ public static final String SECONDARY_MAX_THREADS = "secondaryMaxThreads";
+ public static final String SECONDARY_TIMEOUT = "secondaryTimeout";
+ public static final int SECONDARY_MAX_THREADS_DEFAULT = 50;
+ public static final int SECONDARY_TIMEOUT_DEFAULT = 60000;
}
Modified: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java 2011-04-18 19:53:41 UTC (rev 6329)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -53,7 +53,9 @@
import org.jboss.remoting.transport.socket.SocketServerInvoker;
import org.jboss.logging.Logger;
+import EDU.oswego.cs.dl.util.concurrent.Semaphore;
+
/**
*
* @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
@@ -85,6 +87,8 @@
protected boolean isCallbackServer = false;
protected int secondaryBindPort = -1;
protected int secondaryConnectPort = -1;
+ protected int dosMaxThreads = Bisocket.SECONDARY_MAX_THREADS_DEFAULT;
+ protected int dosTimeout = Bisocket.SECONDARY_TIMEOUT_DEFAULT;
public static BisocketServerInvoker getBisocketServerInvoker(String listenerId)
@@ -199,7 +203,9 @@
secondaryServerSocketThread = new SecondaryServerSocketThread(secondaryServerSocket);
secondaryServerSocketThread.setName("secondaryServerSocketThread");
secondaryServerSocketThread.setDaemon(true);
+ secondaryServerSocketThread.setPriority(Thread.NORM_PRIORITY + acceptThreadPriorityIncrement);
secondaryServerSocketThread.start();
+ log.debug("started SecondaryServerSocketThread with priority " + secondaryServerSocketThread.getPriority());
log.debug("started secondary port: " + host + ":" + secondaryBindPort);
}
}
@@ -509,6 +515,42 @@
log.warn("\"" + Bisocket.SECONDARY_CONNECT_PORT + "\" must be specified as a String");
}
+ o = configuration.get(Bisocket.SECONDARY_MAX_THREADS);
+ if (o instanceof String && ((String) o).length() > 0)
+ {
+ try
+ {
+ dosMaxThreads = Integer.valueOf(((String) o)).intValue();
+ log.debug(this + " setting dosMaxThreads to " + dosMaxThreads);
+ }
+ catch (NumberFormatException e)
+ {
+ log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_MAX_THREADS + "\": " + o);
+ }
+ }
+ else if (o != null)
+ {
+ log.warn("\"" + Bisocket.SECONDARY_MAX_THREADS + "\" must be specified as a String");
+ }
+
+ o = configuration.get(Bisocket.SECONDARY_TIMEOUT);
+ if (o instanceof String && ((String) o).length() > 0)
+ {
+ try
+ {
+ dosTimeout = Integer.valueOf(((String) o)).intValue();
+ log.debug(this + " setting dosTimeout to " + dosTimeout);
+ }
+ catch (NumberFormatException e)
+ {
+ log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_TIMEOUT + "\": " + o);
+ }
+ }
+ else if (o != null)
+ {
+ log.warn("\"" + Bisocket.SECONDARY_TIMEOUT + "\" must be specified as a String");
+ }
+
if (isCallbackServer)
{
socketFactory = createSocketFactory(configuration);
@@ -861,6 +903,7 @@
{
private ServerSocket secondaryServerSocket;
boolean running = true;
+ Semaphore maxThreads = new Semaphore(maxPoolSize);
SecondaryServerSocketThread(ServerSocket secondaryServerSocket) throws IOException
{
@@ -881,41 +924,7 @@
{
Socket socket = secondaryServerSocket.accept();
if (log.isTraceEnabled()) log.trace("accepted: " + socket);
- DataInputStream dis = new DataInputStream(socket.getInputStream());
- int action = dis.read();
- String listenerId = dis.readUTF();
-
- switch (action)
- {
- case Bisocket.CREATE_CONTROL_SOCKET:
- BisocketClientInvoker.transferSocket(listenerId, socket, true);
- if (log.isTraceEnabled())
- log.trace("SecondaryServerSocketThread: created control socket: (" + socket + ")"+ listenerId);
- break;
-
- case Bisocket.RECREATE_CONTROL_SOCKET:
- BisocketClientInvoker invoker = BisocketClientInvoker.getBisocketCallbackClientInvoker(listenerId);
- if (invoker == null)
- {
- log.error("received new control socket for unrecognized listenerId: " + listenerId);
- }
- else
- {
- invoker.replaceControlSocket(socket);
- if (log.isTraceEnabled())
- log.trace("SecondaryServerSocketThread: recreated control socket: " + listenerId);
- }
- break;
-
- case Bisocket.CREATE_ORDINARY_SOCKET:
- BisocketClientInvoker.transferSocket(listenerId, socket, false);
- if (log.isTraceEnabled())
- log.trace("SecondaryServerSocketThread: transferred socket: " + listenerId);
- break;
-
- default:
- log.error("unrecognized action on SecondaryServerSocketThread: " + action);
- }
+ processSocket(socket);
}
catch (IOException e)
{
@@ -928,6 +937,86 @@
}
}
+ void processSocket(final Socket socket) throws IOException
+ {
+ while (true)
+ {
+ try
+ {
+ maxThreads.acquire();
+ break;
+ }
+ catch (InterruptedException e1)
+ {
+ log.trace("unexpected interrupt");
+ }
+ }
+
+ new Thread()
+ {
+ public void run()
+ {
+ setName("processSocketThread: " + socket);
+ if (log.isTraceEnabled()) log.trace(this + " processing socket: " + socket);
+ try
+ {
+ socket.setSoTimeout(DEFAULT_TIMEOUT_PERIOD);
+ DataInputStream dis = new DataInputStream(socket.getInputStream());
+ int action = dis.read();
+ String listenerId = dis.readUTF();
+
+ switch (action)
+ {
+ case Bisocket.CREATE_CONTROL_SOCKET:
+ BisocketClientInvoker.transferSocket(listenerId, socket, true);
+ if (log.isTraceEnabled())
+ log.trace("SecondaryServerSocketThread: created control socket: (" + socket + ")"+ listenerId);
+ break;
+
+ case Bisocket.RECREATE_CONTROL_SOCKET:
+ BisocketClientInvoker invoker = BisocketClientInvoker.getBisocketCallbackClientInvoker(listenerId);
+ if (invoker == null)
+ {
+ log.debug("received new control socket for unrecognized listenerId: " + listenerId);
+ }
+ else
+ {
+ invoker.replaceControlSocket(socket);
+ if (log.isTraceEnabled())
+ log.trace("SecondaryServerSocketThread: recreated control socket: " + listenerId);
+ }
+ break;
+
+ case Bisocket.CREATE_ORDINARY_SOCKET:
+ BisocketClientInvoker.transferSocket(listenerId, socket, false);
+ if (log.isTraceEnabled())
+ log.trace("SecondaryServerSocketThread: transferred socket: " + listenerId);
+ break;
+
+ default:
+ log.error("unrecognized action on SecondaryServerSocketThread: " + action);
+ }
+ }
+ catch (IOException e)
+ {
+ if (running)
+ {
+ log.error(this + " unable to process socket", e);
+ }
+ else
+ {
+ log.debug(this + " unable to process socket", e);
+ }
+ }
+ finally
+ {
+ if (log.isTraceEnabled()) log.trace(this + " processed socket: " + socket);
+ maxThreads.release();
+ }
+ }
+ }.start();
+ }
+
ServerSocket getServerSocket()
{
return secondaryServerSocket;
@@ -1071,4 +1160,4 @@
{
private static final long serialVersionUID = 2846502029152028732L;
}
-}
\ No newline at end of file
+}
Modified: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2011-04-18 19:53:41 UTC (rev 6329)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -17,15 +17,20 @@
package org.jboss.remoting.transport.coyote;
+import org.apache.catalina.Executor;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.core.StandardThreadExecutor;
import org.apache.coyote.ActionCode;
import org.apache.coyote.Adapter;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.Request;
+import org.apache.coyote.Response;
import org.apache.tomcat.util.buf.B2CConverter;
import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.buf.CharChunk;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
+import org.apache.tomcat.util.net.SocketStatus;
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.InvocationResponse;
import org.jboss.remoting.InvokerLocator;
@@ -49,6 +54,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -160,11 +166,12 @@
{
String key = (String) keys.next();
Object obj = config.get(key);
- if (obj instanceof String)
+ if ("executor".equals(key) && obj instanceof String)
{
- String val = (String) obj;
- setProperty(protocolHandler, key, val);
+ createAndSetExecutor(protocolHandler, (String) obj);
+ continue;
}
+ setProperty(protocolHandler, key, obj);
}
// need to convert standard remoting timeout config to tomcat timeout
@@ -948,7 +955,7 @@
* int or boolean we'll convert value to the right type before) - that means
* you can have setDebug(1).
*/
- public static boolean setProperty(Object o, String name, String value)
+ public static boolean setProperty(Object o, String name, Object value)
{
String setter = "set" + capitalize(name);
@@ -956,109 +963,144 @@
{
Method methods[] = o.getClass().getMethods();
Method setPropertyMethod = null;
+ Method setAttributeMethod = null;
+ Method setExecutorMethod = null;
- // First, the ideal case - a setFoo( String ) method
- for(int i = 0; i < methods.length; i++)
+ // Try a setFoo( String) or setFoo ( int ) or ( boolean )
+ if (value instanceof String)
{
- Class paramT[] = methods[i].getParameterTypes();
- if(setter.equals(methods[i].getName()) && paramT.length == 1
- && "java.lang.String".equals(paramT[0].getName()))
+ String stringValue = (String) value;
+ for(int i = 0; i < methods.length; i++)
{
+ boolean ok = true;
+ if(setter.equals(methods[i].getName())
+ && methods[i].getParameterTypes().length == 1)
+ {
- methods[i].invoke(o, new Object[]{value});
- return true;
- }
- }
+ // match - find the type and invoke it
+ Class paramType = methods[i].getParameterTypes()[0];
+ Object params[] = new Object[1];
- // Try a setFoo ( int ) or ( boolean )
- for(int i = 0; i < methods.length; i++)
- {
- boolean ok = true;
- if(setter.equals(methods[i].getName())
- && methods[i].getParameterTypes().length == 1)
- {
-
- // match - find the type and invoke it
- Class paramType = methods[i].getParameterTypes()[0];
- Object params[] = new Object[1];
-
- // Try a setFoo ( int )
- if("java.lang.Integer".equals(paramType.getName())
- || "int".equals(paramType.getName()))
- {
- try
+ // Try a setFoo ( String )
+ if("java.lang.String".equals(paramType.getName()))
{
- params[0] = new Integer(value);
+ params[0] = stringValue;
}
- catch(NumberFormatException ex)
+ // Try a setFoo ( int )
+ else if("java.lang.Integer".equals(paramType.getName())
+ || "int".equals(paramType.getName()))
{
- ok = false;
+ try
+ {
+ params[0] = new Integer(stringValue);
+ }
+ catch(NumberFormatException ex)
+ {
+ ok = false;
+ }
+ // Try a setFoo ( long )
}
- // Try a setFoo ( long )
- }
- else if("java.lang.Long".equals(paramType.getName())
- || "long".equals(paramType.getName()))
- {
- try
+ else if("java.lang.Long".equals(paramType.getName())
+ || "long".equals(paramType.getName()))
{
- params[0] = new Long(value);
+ try
+ {
+ params[0] = new Long(stringValue);
+ }
+ catch(NumberFormatException ex)
+ {
+ ok = false;
+ }
+
+ // Try a setFoo ( boolean )
}
- catch(NumberFormatException ex)
+ else if("java.lang.Boolean".equals(paramType.getName())
+ || "boolean".equals(paramType.getName()))
{
- ok = false;
+ params[0] = new Boolean(stringValue);
+
+ // Try a setFoo ( InetAddress )
}
+ else if("java.net.InetAddress".equals(paramType
+ .getName()))
+ {
+ try
+ {
+ params[0] = InetAddress.getByName(stringValue);
+ }
+ catch(UnknownHostException exc)
+ {
+ ok = false;
+ }
- // Try a setFoo ( boolean )
- }
- else if("java.lang.Boolean".equals(paramType.getName())
- || "boolean".equals(paramType.getName()))
- {
- params[0] = new Boolean(value);
+ // Unknown type
+ }
- // Try a setFoo ( InetAddress )
- }
- else if("java.net.InetAddress".equals(paramType
- .getName()))
- {
- try
+ if(ok)
{
- params[0] = InetAddress.getByName(value);
+ methods[i].invoke(o, params);
+ return true;
}
- catch(UnknownHostException exc)
- {
- ok = false;
- }
-
- // Unknown type
}
-
- if(ok)
+ // save "setProperty" for later
+ if ("setAttribute".equals(methods[i].getName()))
{
- methods[i].invoke(o, params);
- return true;
+ setAttributeMethod = methods[i];
}
+ else if("setProperty".equals(methods[i].getName()))
+ {
+ setPropertyMethod = methods[i];
+ }
}
-
- // save "setProperty" for later
- if("setProperty".equals(methods[i].getName()))
+ }
+ else
+ {
+ for(int i = 0; i < methods.length; i++)
{
- setPropertyMethod = methods[i];
+ // save "setProperty" for later
+ if ("setAttribute".equals(methods[i].getName()))
+ {
+ setAttributeMethod = methods[i];
+ }
+ else if("setProperty".equals(methods[i].getName()))
+ {
+ setPropertyMethod = methods[i];
+ }
+ else if ("setExecutor".equals(methods[i].getName()))
+ {
+ setExecutorMethod = methods[i];
+ }
}
}
- // Ok, no setXXX found, try a setProperty("name", "value")
- if(setPropertyMethod != null)
+ // Ok, no setXXX found, try a setProperty("name", "value") or setAttribute("name", "value")
+ if(setExecutorMethod != null && value instanceof Executor)
{
+ Object params[] = new Object[1];
+ params[0] = value;
+ setExecutorMethod.invoke(o, params);
+ return true;
+ }
+ else if(setAttributeMethod != null)
+ {
Object params[] = new Object[2];
params[0] = name;
params[1] = value;
+ setAttributeMethod.invoke(o, params);
+ return true;
+ }
+ else if(setPropertyMethod != null)
+ {
+ Object params[] = new Object[2];
+ params[0] = name;
+ params[1] = value;
setPropertyMethod.invoke(o, params);
return true;
}
-
}
catch(Exception e)
{
+ log.debug("unable to set property " + name + " to " + value + ": " + e.getMessage());
return false;
}
return false;
@@ -1083,4 +1125,37 @@
{
return contentType.indexOf('\n') + contentType.indexOf('\r') > -2;
}
+
+ static private void createAndSetExecutor(ProtocolHandler protocolHandler, String executorConfig)
+ {
+ Executor executor = new StandardThreadExecutor();
+ log.debug("setting executor to " + executor + " with properties:");
+ if (executorConfig != null)
+ {
+ String[] ss = executorConfig.split(",");
+ for (int i = 0; i < ss.length; i++)
+ {
+ int pos = ss[i].indexOf('=');
+ setProperty(executor, ss[i].substring(0, pos).trim(), ss[i].substring(pos + 1).trim());
+ log.debug(ss[i].substring(0, pos).trim() + ": " + ss[i].substring(pos + 1).trim());
+ }
+ }
+
+ try
+ {
+ executor.start();
+ }
+ catch (LifecycleException e)
+ {
+ log.warn("unable to start executor " + executor, e);
+ return;
+ }
+
+ setProperty(protocolHandler, "executor", executor);
+ }
+
+ public boolean event(Request req, Response res, SocketStatus status) throws Exception
+ {
+ return false;
+ }
}
Modified: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/ssl/RemotingSSLImplementation.java
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/ssl/RemotingSSLImplementation.java 2011-04-18 19:53:41 UTC (rev 6329)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/ssl/RemotingSSLImplementation.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -26,6 +26,7 @@
import java.util.HashMap;
import java.util.Map;
import javax.management.MBeanServer;
+import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import org.apache.tomcat.util.net.SSLImplementation;
import org.apache.tomcat.util.net.SSLSupport;
@@ -63,4 +64,9 @@
{
mbeanServerMap.put(locator, mBeanServer);
}
+
+ public SSLSupport getSSLSupport(SSLSession arg0)
+ {
+ return null;
+ }
}
\ No newline at end of file
Modified: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2011-04-18 19:53:41 UTC (rev 6329)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -86,6 +86,7 @@
protected int maxPoolSize = MAX_POOL_SIZE_DEFAULT;
protected LRUPool clientpool;
protected LinkedList threadpool;
+ protected int acceptThreadPriorityIncrement = 0;
protected boolean newServerSocketFactory = false;
protected Object serverSocketFactoryLock = new Object();
@@ -214,8 +215,10 @@
String name = getThreadName(i);
acceptThreads[i] = new Thread(this, name);
+ acceptThreads[i].setPriority(Thread.NORM_PRIORITY + acceptThreadPriorityIncrement);
- if(trace) { log.trace(this + " created and registered " + acceptThreads[i]); }
+ if(trace) { log.trace(this + " created and registered " + acceptThreads[i]
+ + " with priority " + acceptThreads[i].getPriority()); }
}
}
@@ -511,6 +514,24 @@
this.writeTimeout = writeTimeout;
}
+ public int getAcceptThreadPriorityIncrement()
+ {
+ return acceptThreadPriorityIncrement;
+ }
+
+ public void setAcceptThreadPriorityIncrement(int acceptThreadPriorityIncrement)
+ {
+ int resultingPriority = Thread.NORM_PRIORITY + acceptThreadPriorityIncrement;
+ if (resultingPriority < Thread.MIN_PRIORITY || resultingPriority > Thread.MAX_PRIORITY)
+ {
+ log.warn(this + " resulting priority out of range: " + resultingPriority);
+ }
+ else
+ {
+ this.acceptThreadPriorityIncrement = acceptThreadPriorityIncrement;
+ }
+ }
+
public void run()
{
if(trace) { log.trace(this + " started execution of method run()"); }
@@ -607,8 +628,9 @@
worker = new ServerThread(socket, this, clientpool, threadpool,
getTimeout(), writeTimeout, serverSocketClass);
+ worker.setPriority(Thread.NORM_PRIORITY);
- if(trace) { log.trace(this + " created " + worker); }
+ if(trace) { log.trace(this + " created " + worker + " with priority " + worker.getPriority()); }
newThread = true;
}
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/connection/params/ConnectionValidatorConfigurationTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Deleted: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java 2011-03-19 20:51:35 UTC (rev 6284)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -1,217 +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.bisocket.accept;
-
-import java.lang.reflect.Field;
-import java.net.InetAddress;
-import java.util.HashMap;
-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.bisocket.BisocketServerInvoker;
-import org.jboss.remoting.transport.socket.SocketServerInvoker;
-
-
-/**
- * Unit tests for JBREM-1277
- *
- * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1 $
- * <p>
- * Copyright Mar 19, 2011
- */
-public class SecondaryAcceptThreadPriorityTestCase extends TestCase
-{
- protected static String NUM_ACCEPT_THREADS = "3";
- protected static String PRIORITY_INCREMENT = "4";
-
- private static Logger log = Logger.getLogger(SecondaryAcceptThreadPriorityTestCase.class);
-
- private static boolean firstTime = 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 = false;
- Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
- Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
- String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
- PatternLayout layout = new PatternLayout(pattern);
- ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- Logger.getRootLogger().addAppender(consoleAppender);
- }
- }
-
-
- public void tearDown()
- {
- }
-
-
- public void testAcceptThreadPriority() throws Throwable
- {
- log.info("entering " + getName());
-
- // Start server.
- setupServer(PRIORITY_INCREMENT);
-
- // Create client.
- InvokerLocator clientLocator = new InvokerLocator(locatorURI);
- HashMap clientConfig = new HashMap();
- clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraClientConfig(clientConfig);
- Client client = new Client(clientLocator, clientConfig);
- client.connect();
- log.info("client is connected");
-
- // Test connections.
- assertEquals("abc", client.invoke("abc"));
- log.info("connection is good");
-
- // Test accept threads priority.
- int defaultPriority = Thread.NORM_PRIORITY;
- int expectedPriority = defaultPriority + Integer.valueOf(PRIORITY_INCREMENT).intValue();
- Field field = BisocketServerInvoker.class.getDeclaredField("secondaryServerSocketThread");
- field.setAccessible(true);
- Thread secondaryServerSocketThread = (Thread) field.get((BisocketServerInvoker) connector.getServerInvoker());
- assertEquals(expectedPriority, secondaryServerSocketThread.getPriority());
-
- client.disconnect();
- shutdownServer();
- log.info(getName() + " PASSES");
- }
-
- public void testAcceptThreadPriorityInvalidValue() throws Throwable
- {
- log.info("entering " + getName());
-
- // Discover invalid thread priority value.
- int invalidPriority = Thread.MAX_PRIORITY + 1;
-
- // Start server.
- setupServer(Integer.toString(invalidPriority));
-
- // Create client.
- InvokerLocator clientLocator = new InvokerLocator(locatorURI);
- HashMap clientConfig = new HashMap();
- clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraClientConfig(clientConfig);
- Client client = new Client(clientLocator, clientConfig);
- client.connect();
- log.info("client is connected");
-
- // Test connections.
- assertEquals("abc", client.invoke("abc"));
- log.info("connection is good");
-
- // Test accept threads priority.
- int defaultPriority = Thread.NORM_PRIORITY;
- Field field = BisocketServerInvoker.class.getDeclaredField("secondaryServerSocketThread");
- field.setAccessible(true);
- Thread secondaryServerSocketThread = (Thread) field.get((BisocketServerInvoker) connector.getServerInvoker());
- assertEquals(defaultPriority, secondaryServerSocketThread.getPriority());
-
- client.disconnect();
- shutdownServer();
- log.info(getName() + " PASSES");
- }
-
- protected String getTransport()
- {
- return "bisocket";
- }
-
-
- protected void addExtraClientConfig(Map config) {}
- protected void addExtraServerConfig(Map config) {}
-
-
- protected void setupServer(String increment) throws Exception
- {
- host = InetAddress.getLocalHost().getHostAddress();
- port = PortUtil.findFreePort(host);
- locatorURI = getTransport() + "://" + host + ":" + port;
- locatorURI += "/?numAcceptThreads=" + NUM_ACCEPT_THREADS;
- locatorURI += "&acceptThreadPriorityIncrement=" + increment;
- String metadata = System.getProperty("remoting.metadata");
- if (metadata != null)
- {
- locatorURI += "&" + metadata;
- }
- serverLocator = new InvokerLocator(locatorURI);
- log.info("Starting remoting server with locator uri of: " + locatorURI);
- HashMap config = new HashMap();
- config.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraServerConfig(config);
- connector = new Connector(serverLocator, config);
- connector.create();
- invocationHandler = new TestInvocationHandler();
- connector.addInvocationHandler("test", invocationHandler);
- connector.start();
- }
-
-
- protected void shutdownServer() throws Exception
- {
- if (connector != null)
- connector.stop();
- }
-
-
- static class TestInvocationHandler implements ServerInvocationHandler
- {
- public void addListener(InvokerCallbackHandler callbackHandler) {}
- public Object invoke(final InvocationRequest invocation) throws Throwable
- {
- 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/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java (from rev 6284, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java)
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java (rev 0)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -0,0 +1,217 @@
+/*
+ * 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.bisocket.accept;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+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.bisocket.BisocketServerInvoker;
+import org.jboss.remoting.transport.socket.SocketServerInvoker;
+
+
+/**
+ * Unit tests for JBREM-1277
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Mar 19, 2011
+ */
+public class SecondaryAcceptThreadPriorityTestCase extends TestCase
+{
+ protected static String NUM_ACCEPT_THREADS = "3";
+ protected static String PRIORITY_INCREMENT = "4";
+
+ private static Logger log = Logger.getLogger(SecondaryAcceptThreadPriorityTestCase.class);
+
+ private static boolean firstTime = 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 = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testAcceptThreadPriority() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(PRIORITY_INCREMENT);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Test accept threads priority.
+ int defaultPriority = Thread.NORM_PRIORITY;
+ int expectedPriority = defaultPriority + Integer.valueOf(PRIORITY_INCREMENT).intValue();
+ Field field = BisocketServerInvoker.class.getDeclaredField("secondaryServerSocketThread");
+ field.setAccessible(true);
+ Thread secondaryServerSocketThread = (Thread) field.get((BisocketServerInvoker) connector.getServerInvoker());
+ assertEquals(expectedPriority, secondaryServerSocketThread.getPriority());
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+ public void testAcceptThreadPriorityInvalidValue() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Discover invalid thread priority value.
+ int invalidPriority = Thread.MAX_PRIORITY + 1;
+
+ // Start server.
+ setupServer(Integer.toString(invalidPriority));
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Test accept threads priority.
+ int defaultPriority = Thread.NORM_PRIORITY;
+ Field field = BisocketServerInvoker.class.getDeclaredField("secondaryServerSocketThread");
+ field.setAccessible(true);
+ Thread secondaryServerSocketThread = (Thread) field.get((BisocketServerInvoker) connector.getServerInvoker());
+ assertEquals(defaultPriority, secondaryServerSocketThread.getPriority());
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+ protected String getTransport()
+ {
+ return "bisocket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer(String increment) throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ locatorURI += "/?numAcceptThreads=" + NUM_ACCEPT_THREADS;
+ locatorURI += "&acceptThreadPriorityIncrement=" + increment;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "&" + metadata;
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraServerConfig(config);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+}
\ No newline at end of file
Deleted: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java 2010-12-18 02:23:26 UTC (rev 6178)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -1,287 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, 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.bisocket.dos;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-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.Callback;
-import org.jboss.remoting.callback.HandleCallbackException;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.transport.Connector;
-import org.jboss.remoting.transport.PortUtil;
-import org.jboss.remoting.transport.bisocket.Bisocket;
-
-/**
- * @author <a href="mailto:ron.sigal@jboss.com">Ron Sigal</a>
- * @version $Rev$
- * <p>
- * Copyright Oct 13, 2010
- * </p>
- */
-public class DosTestCase extends TestCase
-{
- private static final Logger log = Logger.getLogger(DosTestCase.class);
- private static final String CALLBACK_TEST = "callbackTest";
-
- private static boolean firstTime = true;
-
- protected String host;
- protected int port;
- protected int secondaryPort;
- protected String locatorURI;
- protected InvokerLocator serverLocator;
- protected Connector connector;
- protected TestInvocationHandler invocationHandler;
- protected Object lock = new Object();
- protected boolean dosAttackThreadRan;
- protected boolean secondCallbackRan;
-
-
- public void setUp() throws Exception
- {
- if (firstTime)
- {
- firstTime = false;
- Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO);
- Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
- String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
- PatternLayout layout = new PatternLayout(pattern);
- ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- Logger.getRootLogger().addAppender(consoleAppender);
- }
- }
-
-
- public void tearDown()
- {
- }
-
- public void testDosAttack() throws Throwable
- {
- log.info("entering " + getName());
-
- // Start server.
- setupServer();
-
- // Create client.
- HashMap clientConfig = new HashMap();
- clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraClientConfig(clientConfig);
- final Client client = new Client(serverLocator, clientConfig);
- client.connect();
- assertEquals("abc", client.invoke("abc"));
- log.info("client is connected");
-
- // Add callback handler.
- TestCallbackHandler callbackHandler = new TestCallbackHandler();
- HashMap metadata = new HashMap();
- metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
- client.addListener(callbackHandler, metadata);
- client.invoke(CALLBACK_TEST);
- assertEquals(1, callbackHandler.counter);
- log.info("callback handler is installed");
-
- // Test DOS attack.
- new Thread()
- {
- public void run()
- {
- try
- {
- Socket s = new Socket(host, secondaryPort);
- log.info(this + " created socket " + s);
- synchronized (lock)
- {
- dosAttackThreadRan = true;
- }
- }
- catch (IOException e)
- {
- log.error("unable to connect to secondaryPort: " + secondaryPort, e);
- }
- finally
- {
- synchronized (lock)
- {
- lock.notifyAll();
- }
- }
- }
- }.start();
-
- Thread.sleep(2000);
-
- synchronized (lock)
- {
- if (!dosAttackThreadRan)
- {
- long start = System.currentTimeMillis();
- long end = start + 10000;
- while (end - System.currentTimeMillis() > 0)
- {
- try
- {
- lock.wait(end - System.currentTimeMillis());
- }
- catch (InterruptedException e){
-
- }
- }
- }
- }
-
- if (!dosAttackThreadRan)
- {
- fail("DOS attack thread did not run");
- }
-
-
- // DOS attack has occurred. Try to add another callback handler.
- new Thread()
- {
- public void run()
- {
- TestCallbackHandler callbackHandler2 = new TestCallbackHandler();
- try
- {
-
- HashMap metadata = new HashMap();
- metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
- client.addListener(callbackHandler2, metadata);
- secondCallbackRan = true;
- log.info(this + " second callback handler installed after DOS attack");
- }
- catch (Throwable e)
- {
- log.info(this + " second callback failed", e);
- }
- }
- }.start();
-
- Thread.sleep(10000);
- assertTrue(secondCallbackRan);
-
- client.removeListener(callbackHandler);
- client.disconnect();
- connector.stop();
- }
-
- protected String getTransport()
- {
- return "bisocket";
- }
-
-
- protected void addExtraClientConfig(Map config) {}
- protected void addExtraServerConfig(Map config) {}
-
-
- protected void setupServer() throws Exception
- {
- host = InetAddress.getLocalHost().getHostAddress();
- port = PortUtil.findFreePort(host);
- secondaryPort = PortUtil.findFreePort(host);
- locatorURI = getTransport() + "://" + host + ":" + port + "/?secondaryBindPort=" + secondaryPort;
- String metadata = System.getProperty("remoting.metadata");
- if (metadata != null)
- {
- locatorURI += "&" + metadata;
- }
- serverLocator = new InvokerLocator(locatorURI);
- log.info("Starting remoting server with locator uri of: " + locatorURI);
- HashMap config = new HashMap();
- config.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraServerConfig(config);
- connector = new Connector(serverLocator, config);
- connector.create();
- invocationHandler = new TestInvocationHandler();
- connector.addInvocationHandler("test", invocationHandler);
- connector.start();
- }
-
-
- protected void shutdownServer() throws Exception
- {
- if (connector != null)
- connector.stop();
- }
-
-
-
- static class TestInvocationHandler implements ServerInvocationHandler
- {
- public Set listeners = new HashSet();
-
- public void addListener(InvokerCallbackHandler callbackHandler)
- {
- listeners.add(callbackHandler);
- }
- public Object invoke(final InvocationRequest invocation) throws Throwable
- {
- if (CALLBACK_TEST.equals(invocation.getParameter()))
- {
- Iterator it = listeners.iterator();
- while (it.hasNext())
- {
- InvokerCallbackHandler handler = (InvokerCallbackHandler) it.next();
- handler.handleCallback(new Callback("test"));
- log.info(this + " sent callback");
- }
- }
- return invocation.getParameter();
- }
- public void removeListener(InvokerCallbackHandler callbackHandler) {}
- public void setMBeanServer(MBeanServer server) {}
- public void setInvoker(ServerInvoker invoker) {}
- }
-
- static class TestCallbackHandler implements InvokerCallbackHandler
- {
- public int counter;
-
- public void handleCallback(Callback callback) throws HandleCallbackException
- {
- log.info(this + " received callback");
- counter++;
- }
- }
-}
\ 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/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java (from rev 6178, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java)
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java (rev 0)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -0,0 +1,388 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, 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.bisocket.dos;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+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.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.bisocket.Bisocket;
+
+/**
+ * @author <a href="mailto:ron.sigal@jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Oct 13, 2010
+ * </p>
+ */
+public class DosTestCase extends TestCase
+{
+ private static final Logger log = Logger.getLogger(DosTestCase.class);
+ private static final String CALLBACK_TEST = "callbackTest";
+
+ private static boolean firstTime = true;
+
+ protected String host;
+ protected int port;
+ protected int secondaryPort;
+ protected String locatorURI;
+ protected InvokerLocator serverLocator;
+ protected Connector connector;
+ protected TestInvocationHandler invocationHandler;
+ protected Object lock = new Object();
+ protected boolean dosAttackThreadRan;
+ protected boolean secondCallbackRan;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+ public void testDosAttack() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ final Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ assertEquals("abc", client.invoke("abc"));
+ log.info("client is connected");
+
+ // Add callback handler.
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ HashMap metadata = new HashMap();
+ metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+ client.addListener(callbackHandler, metadata);
+ client.invoke(CALLBACK_TEST);
+ assertEquals(1, callbackHandler.counter);
+ log.info("callback handler is installed");
+
+ // Test DOS attack.
+ new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ Socket s = new Socket(host, secondaryPort);
+ log.info(this + " created socket " + s);
+ synchronized (lock)
+ {
+ dosAttackThreadRan = true;
+ }
+ }
+ catch (IOException e)
+ {
+ log.error("unable to connect to secondaryPort: " + secondaryPort, e);
+ }
+ finally
+ {
+ synchronized (lock)
+ {
+ lock.notifyAll();
+ }
+ }
+ }
+ }.start();
+
+ Thread.sleep(2000);
+
+ synchronized (lock)
+ {
+ if (!dosAttackThreadRan)
+ {
+ long start = System.currentTimeMillis();
+ long end = start + 10000;
+ while (end - System.currentTimeMillis() > 0)
+ {
+ try
+ {
+ lock.wait(end - System.currentTimeMillis());
+ }
+ catch (InterruptedException e){
+
+ }
+ }
+ }
+ }
+
+ if (!dosAttackThreadRan)
+ {
+ fail("DOS attack thread did not run");
+ }
+
+
+ // DOS attack has occurred. Try to add another callback handler.
+ new Thread()
+ {
+ public void run()
+ {
+ TestCallbackHandler callbackHandler2 = new TestCallbackHandler();
+ try
+ {
+
+ HashMap metadata = new HashMap();
+ metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+ client.addListener(callbackHandler2, metadata);
+ secondCallbackRan = true;
+ log.info(this + " second callback handler installed after DOS attack");
+ }
+ catch (Throwable e)
+ {
+ log.info(this + " second callback failed", e);
+ }
+ }
+ }.start();
+
+ Thread.sleep(10000);
+ assertTrue(secondCallbackRan);
+
+ client.removeListener(callbackHandler);
+ client.disconnect();
+ connector.stop();
+ }
+
+
+ public void testConfigurationDefault() throws Throwable
+ {
+ log.info("entering " + getName());
+ doConfigurationTest(false, false, Bisocket.SECONDARY_MAX_THREADS_DEFAULT, Bisocket.SECONDARY_TIMEOUT_DEFAULT);
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testConfigurationMap() throws Throwable
+ {
+ log.info("entering " + getName());
+ doConfigurationTest(true, false, dosMaxThreadsValue, dosTimeoutValue);
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testConfigurationInvokerLocater() throws Throwable
+ {
+ log.info("entering " + getName());
+ doConfigurationTest(true, true, dosMaxThreadsValue, dosTimeoutValue);
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected void doConfigurationTest(boolean setParameters, boolean useInvokerLocator, int threadCount, int timeout) throws Throwable
+ {
+ // Start server.
+ setupServer(setParameters, useInvokerLocator);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ final Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ assertEquals("abc", client.invoke("abc"));
+ log.info("client is connected");
+
+ // Add callback handler.
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ HashMap metadata = new HashMap();
+ metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+ client.addListener(callbackHandler, metadata);
+ client.invoke(CALLBACK_TEST);
+ assertEquals(1, callbackHandler.counter);
+ log.info("callback handler is installed");
+
+ BisocketServerInvoker invoker = (BisocketServerInvoker) connector.getServerInvoker();
+ assertEquals(threadCount, invoker.getDosMaxThreads());
+ assertEquals(timeout, invoker.getDosTimeout());
+ verifyThreadValues(invoker, threadCount, timeout);
+
+ client.removeListener(callbackHandler);
+ client.disconnect();
+ connector.stop();
+ }
+
+
+ protected boolean verifyThreadValues(ServerInvoker invoker, int threadCount, int timeout) throws Exception
+ {
+ Class[] classes = BisocketServerInvoker.class.getDeclaredClasses();
+ Class threadClass = null;
+ for (int i = 0; i < classes.length; i++)
+ {
+ if (classes[i].getName().indexOf("SecondaryServerSocketThread") > -1)
+ {
+ threadClass = classes[i];
+ break;
+ }
+ }
+ log.info("threadClass: " + threadClass);
+ Field field = BisocketServerInvoker.class.getDeclaredField("secondaryServerSocketThread");
+ field.setAccessible(true);
+ Thread secondaryServerSocketThread = (Thread) field.get(invoker);
+ Field maxThreads = threadClass.getDeclaredField("maxThreads");
+ maxThreads.setAccessible(true);
+ Field localDosTimeout = threadClass.getDeclaredField("localDosTimeout");
+ localDosTimeout.setAccessible(true);
+
+ assertEquals(threadCount, ((Semaphore)maxThreads.get(secondaryServerSocketThread)).permits());
+ assertEquals(timeout, ((Integer)localDosTimeout.get(secondaryServerSocketThread)).intValue());
+ return true;
+ }
+
+
+ protected String getTransport()
+ {
+ return "bisocket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer() throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ secondaryPort = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port + "/?secondaryBindPort=" + secondaryPort;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "&" + metadata;
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraServerConfig(config);
+ if (setParameters)
+ {
+ if (useInvokerLocator)
+ {
+ locatorURI += "&" + Bisocket.SECONDARY_MAX_THREADS + "=" + Integer.toString(dosMaxThreadsValue);
+ locatorURI += "&" + Bisocket.SECONDARY_TIMEOUT + "=" + Integer.toString(dosTimeoutValue);
+ }
+ else
+ {
+ config.put(Bisocket.SECONDARY_MAX_THREADS, Integer.toString(dosMaxThreadsValue));
+ config.put(Bisocket.SECONDARY_TIMEOUT, Integer.toString(dosTimeoutValue));
+ }
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public Set listeners = new HashSet();
+
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ listeners.add(callbackHandler);
+ }
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ if (CALLBACK_TEST.equals(invocation.getParameter()))
+ {
+ Iterator it = listeners.iterator();
+ while (it.hasNext())
+ {
+ InvokerCallbackHandler handler = (InvokerCallbackHandler) it.next();
+ handler.handleCallback(new Callback("test"));
+ log.info(this + " sent callback");
+ }
+ }
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+
+ static class TestCallbackHandler implements InvokerCallbackHandler
+ {
+ public int counter;
+
+ public void handleCallback(Callback callback) throws HandleCallbackException
+ {
+ log.info(this + " received callback");
+ counter++;
+ }
+ }
+}
\ No newline at end of file
Deleted: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java 2011-04-13 20:24:24 UTC (rev 6313)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -1,189 +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.coyote;
-
-import java.lang.reflect.Field;
-import java.net.InetAddress;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-
-import junit.framework.TestCase;
-
-import org.apache.coyote.http11.Http11Protocol;
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-import org.jboss.logging.XLevel;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.transport.Connector;
-import org.jboss.remoting.transport.PortUtil;
-import org.jboss.remoting.transport.coyote.CoyoteInvoker;
-
-
-/**
- * Unit test for JBREM-1281
- *
- * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1 $
- * <p>
- * Copyright Apr 13, 2011
- */
-public class SetAttributeTestCase extends TestCase
-{
- private static Logger log = Logger.getLogger(SetAttributeTestCase.class);
-
- private static boolean firstTime = 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 = false;
- Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
- Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
- String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
- PatternLayout layout = new PatternLayout(pattern);
- ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- Logger.getRootLogger().addAppender(consoleAppender);
- }
- }
-
-
- public void tearDown()
- {
- }
-
-
- public void testSetExecutor() throws Throwable
- {
- log.info("entering " + getName());
-
- // Start server.
- host = InetAddress.getLocalHost().getHostAddress();
- port = PortUtil.findFreePort(host);
- locatorURI = getTransport() + "://" + host + ":" + port;
- String metadata = System.getProperty("remoting.metadata");
- if (metadata != null)
- {
- locatorURI += "/?" + metadata;
- }
- serverLocator = new InvokerLocator(locatorURI);
- log.info("Starting remoting server with locator uri of: " + locatorURI);
- HashMap config = new HashMap();
- config.put(InvokerLocator.FORCE_REMOTE, "true");
-
- // Attributes set directly on Http11Protocol
- config.put("maxSavePostSize", "3");
- config.put("keepAlive", "false");
- config.put("compression", "on");
- config.put("testObject", new TestObject(5));
-
- // Attributes set on Http11Protocol.endpoint
- config.put("soTimeout", "7");
- config.put("tcpNoDelay", "true");
- config.put("address", InetAddress.getLocalHost());
-
- connector = new Connector(serverLocator, config);
- connector.create();
- invocationHandler = new TestInvocationHandler();
- connector.addInvocationHandler("test", invocationHandler);
- connector.start();
- CoyoteInvoker invoker = (CoyoteInvoker) connector.getServerInvoker();
- Field field = CoyoteInvoker.class.getDeclaredField("protocolHandler");
- field.setAccessible(true);
- Http11Protocol protocolHandler = (Http11Protocol) field.get(invoker);
- log.info("maxSavePostSize: " + protocolHandler.getMaxSavePostSize());
- log.info("keepAlive: " + protocolHandler.getKeepAlive());
- log.info("compression: " + protocolHandler.getCompression());
- log.info("testObject: " + protocolHandler.getAttribute("testObject"));
-
- log.info("soTimeout: " + protocolHandler.getSoTimeout());
- log.info("tcpNoDelay: " + protocolHandler.getTcpNoDelay());
- log.info("address: " + protocolHandler.getAddress());
-
- assertEquals(new Integer(3), new Integer(protocolHandler.getMaxSavePostSize()));
- assertEquals(Boolean.FALSE, new Boolean(protocolHandler.getKeepAlive()));
- assertEquals("on", protocolHandler.getCompression());
- assertEquals(new TestObject(5), protocolHandler.getAttribute("testObject"));
-
- assertEquals(new Integer(7), new Integer(protocolHandler.getSoTimeout()));
- assertEquals(Boolean.TRUE, new Boolean(protocolHandler.getTcpNoDelay()));
- assertEquals(InetAddress.getLocalHost(), protocolHandler.getAddress());
-
- if (connector != null)
- connector.stop();
- log.info(getName() + " PASSES");
- }
-
-
- protected String getTransport()
- {
- return "http";
- }
-
-
- protected void addExtraClientConfig(Map config) {}
- protected void addExtraServerConfig(Map config) {}
-
- static class TestInvocationHandler implements ServerInvocationHandler
- {
- public void addListener(InvokerCallbackHandler callbackHandler) {}
- public Object invoke(final InvocationRequest invocation) throws Throwable
- {
- return invocation.getParameter();
- }
- public void removeListener(InvokerCallbackHandler callbackHandler) {}
- public void setMBeanServer(MBeanServer server) {}
- public void setInvoker(ServerInvoker invoker) {}
- }
-
- static class TestObject
- {
- private int secret;
- public TestObject(int secret) {this.secret = secret;}
- public boolean equals(Object o)
- {
- if (!(o instanceof TestObject)) return false;
- return this.secret == ((TestObject) o).secret;
- }
- public String toString()
- {
- return "TestObject(" + secret + ")";
- }
- }
-}
\ 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/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java (from rev 6313, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java)
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java (rev 0)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -0,0 +1,189 @@
+/*
+ * 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.coyote;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
+import junit.framework.TestCase;
+
+import org.apache.coyote.http11.Http11Protocol;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.coyote.CoyoteInvoker;
+
+
+/**
+ * Unit test for JBREM-1281
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Apr 13, 2011
+ */
+public class SetAttributeTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(SetAttributeTestCase.class);
+
+ private static boolean firstTime = 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 = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testSetExecutor() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "/?" + metadata;
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+
+ // Attributes set directly on Http11Protocol
+ config.put("maxSavePostSize", "3");
+ config.put("keepAlive", "false");
+ config.put("compression", "on");
+ config.put("testObject", new TestObject(5));
+
+ // Attributes set on Http11Protocol.endpoint
+ config.put("soTimeout", "7");
+ config.put("tcpNoDelay", "true");
+ config.put("address", InetAddress.getLocalHost());
+
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ CoyoteInvoker invoker = (CoyoteInvoker) connector.getServerInvoker();
+ Field field = CoyoteInvoker.class.getDeclaredField("protocolHandler");
+ field.setAccessible(true);
+ Http11Protocol protocolHandler = (Http11Protocol) field.get(invoker);
+ log.info("maxSavePostSize: " + protocolHandler.getMaxSavePostSize());
+ log.info("keepAlive: " + protocolHandler.getKeepAlive());
+ log.info("compression: " + protocolHandler.getCompression());
+ log.info("testObject: " + protocolHandler.getAttribute("testObject"));
+
+ log.info("soTimeout: " + protocolHandler.getSoTimeout());
+ log.info("tcpNoDelay: " + protocolHandler.getTcpNoDelay());
+ log.info("address: " + protocolHandler.getAddress());
+
+ assertEquals(new Integer(3), new Integer(protocolHandler.getMaxSavePostSize()));
+ assertEquals(Boolean.FALSE, new Boolean(protocolHandler.getKeepAlive()));
+ assertEquals("on", protocolHandler.getCompression());
+ assertEquals(new TestObject(5), protocolHandler.getAttribute("testObject"));
+
+ assertEquals(new Integer(7), new Integer(protocolHandler.getSoTimeout()));
+ assertEquals(Boolean.TRUE, new Boolean(protocolHandler.getTcpNoDelay()));
+ assertEquals(InetAddress.getLocalHost(), protocolHandler.getAddress());
+
+ if (connector != null)
+ connector.stop();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected String getTransport()
+ {
+ return "http";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+
+ static class TestObject
+ {
+ private int secret;
+ public TestObject(int secret) {this.secret = secret;}
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof TestObject)) return false;
+ return this.secret == ((TestObject) o).secret;
+ }
+ public String toString()
+ {
+ return "TestObject(" + secret + ")";
+ }
+ }
+}
\ No newline at end of file
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/ServletConfigurationMapTestClient.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/remoting-servlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/remoting-servlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/keystore
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/remoting-sslservlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/truststore
___________________________________________________________________
Deleted: svn:mergeinfo
-
Deleted: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java 2011-03-19 20:51:35 UTC (rev 6284)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -1,228 +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.accept;
-
-import java.lang.reflect.Field;
-import java.net.InetAddress;
-import java.util.HashMap;
-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.SocketServerInvoker;
-
-
-/**
- * Unit tests for JBREM-1277
- *
- * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1 $
- * <p>
- * Copyright Mar 19, 2011
- */
-public class AcceptThreadPriorityTestCase extends TestCase
-{
- protected static String NUM_ACCEPT_THREADS = "3";
- protected static String PRIORITY_INCREMENT = "4";
-
- private static Logger log = Logger.getLogger(AcceptThreadPriorityTestCase.class);
-
- private static boolean firstTime = 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 = false;
- Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
- Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
- String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
- PatternLayout layout = new PatternLayout(pattern);
- ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- Logger.getRootLogger().addAppender(consoleAppender);
- }
- }
-
-
- public void tearDown()
- {
- }
-
-
- public void testAcceptThreadPriority() throws Throwable
- {
- log.info("entering " + getName());
-
- // Start server.
- setupServer(PRIORITY_INCREMENT);
-
- // Create client.
- InvokerLocator clientLocator = new InvokerLocator(locatorURI);
- HashMap clientConfig = new HashMap();
- clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraClientConfig(clientConfig);
- Client client = new Client(clientLocator, clientConfig);
- client.connect();
- log.info("client is connected");
-
- // Test connections.
- assertEquals("abc", client.invoke("abc"));
- log.info("connection is good");
-
- // Test accept threads priority.
- int defaultPriority = Thread.NORM_PRIORITY;
- int expectedPriority = defaultPriority + Integer.valueOf(PRIORITY_INCREMENT).intValue();
- Field field = SocketServerInvoker.class.getDeclaredField("acceptThreads");
- field.setAccessible(true);
- Thread[] acceptThreads = (Thread[]) field.get((SocketServerInvoker) connector.getServerInvoker());
- assertEquals(Integer.valueOf(NUM_ACCEPT_THREADS).intValue(), acceptThreads.length);
- for (int i = 0; i < acceptThreads.length; i++)
- {
- log.info("acceptThreads[" + i + "].getPriority(): " + acceptThreads[i].getPriority());
- assertEquals(expectedPriority, acceptThreads[i].getPriority());
-
- }
-
- client.disconnect();
- shutdownServer();
- log.info(getName() + " PASSES");
- }
-
- public void testAcceptThreadPriorityInvalidValue() throws Throwable
- {
- log.info("entering " + getName());
-
- // Discover invalid thread priority value.
- int invalidPriority = Thread.MAX_PRIORITY + 1;
-
- // Start server.
- setupServer(Integer.toString(invalidPriority));
-
- // Create client.
- InvokerLocator clientLocator = new InvokerLocator(locatorURI);
- HashMap clientConfig = new HashMap();
- clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraClientConfig(clientConfig);
- Client client = new Client(clientLocator, clientConfig);
- client.connect();
- log.info("client is connected");
-
- // Test connections.
- assertEquals("abc", client.invoke("abc"));
- log.info("connection is good");
-
- // Test accept threads priority.
- int defaultPriority = Thread.NORM_PRIORITY;
- Field field = SocketServerInvoker.class.getDeclaredField("acceptThreads");
- field.setAccessible(true);
- Thread[] acceptThreads = (Thread[]) field.get((SocketServerInvoker) connector.getServerInvoker());
- assertEquals(Integer.valueOf(NUM_ACCEPT_THREADS).intValue(), acceptThreads.length);
- for (int i = 0; i < acceptThreads.length; i++)
- {
- log.info("acceptThreads[" + i + "].getPriority(): " + acceptThreads[i].getPriority());
- assertEquals(defaultPriority, acceptThreads[i].getPriority());
-
- }
-
- client.disconnect();
- shutdownServer();
- log.info(getName() + " PASSES");
- }
-
- protected String getTransport()
- {
- return "socket";
- }
-
-
- protected void addExtraClientConfig(Map config) {}
- protected void addExtraServerConfig(Map config) {}
-
-
- protected void setupServer(String increment) throws Exception
- {
- host = InetAddress.getLocalHost().getHostAddress();
- port = PortUtil.findFreePort(host);
- locatorURI = getTransport() + "://" + host + ":" + port;
- locatorURI += "/?numAcceptThreads=" + NUM_ACCEPT_THREADS;
- locatorURI += "&acceptThreadPriorityIncrement=" + increment;
- String metadata = System.getProperty("remoting.metadata");
- if (metadata != null)
- {
- locatorURI += "&" + metadata;
- }
- serverLocator = new InvokerLocator(locatorURI);
- log.info("Starting remoting server with locator uri of: " + locatorURI);
- HashMap config = new HashMap();
- config.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraServerConfig(config);
- connector = new Connector(serverLocator, config);
- connector.create();
- invocationHandler = new TestInvocationHandler();
- connector.addInvocationHandler("test", invocationHandler);
- connector.start();
- }
-
-
- protected void shutdownServer() throws Exception
- {
- if (connector != null)
- connector.stop();
- }
-
-
- static class TestInvocationHandler implements ServerInvocationHandler
- {
- public void addListener(InvokerCallbackHandler callbackHandler) {}
- public Object invoke(final InvocationRequest invocation) throws Throwable
- {
- 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/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java (from rev 6284, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java)
===================================================================
--- remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java (rev 0)
+++ remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java 2011-04-18 20:23:14 UTC (rev 6330)
@@ -0,0 +1,278 @@
+/*
+ * 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.accept;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+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;
+
+
+/**
+ * Unit tests for JBREM-1277
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Mar 19, 2011
+ */
+public class AcceptThreadPriorityTestCase extends TestCase
+{
+ protected static String NUM_ACCEPT_THREADS = "3";
+ protected static String PRIORITY_INCREMENT = "4";
+
+ private static Logger log = Logger.getLogger(AcceptThreadPriorityTestCase.class);
+
+ private static boolean firstTime = 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 = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testAcceptThreadPriority() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(PRIORITY_INCREMENT);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Test accept threads priority.
+ int defaultPriority = Thread.NORM_PRIORITY;
+ int expectedPriority = defaultPriority + Integer.valueOf(PRIORITY_INCREMENT).intValue();
+ Field field = SocketServerInvoker.class.getDeclaredField("acceptThreads");
+ field.setAccessible(true);
+ Thread[] acceptThreads = (Thread[]) field.get((SocketServerInvoker) connector.getServerInvoker());
+ assertEquals(Integer.valueOf(NUM_ACCEPT_THREADS).intValue(), acceptThreads.length);
+ for (int i = 0; i < acceptThreads.length; i++)
+ {
+ log.info("acceptThreads[" + i + "].getPriority(): " + acceptThreads[i].getPriority());
+ assertEquals(expectedPriority, acceptThreads[i].getPriority());
+
+ }
+
+ // Test worker threads priority.
+ field = SocketServerInvoker.class.getDeclaredField("clientpool");
+ field.setAccessible(true);
+ LRUPool clientpool = (LRUPool) field.get((SocketServerInvoker) connector.getServerInvoker());
+ Iterator it = clientpool.getContents().iterator();
+ while (it.hasNext())
+ {
+ Thread t = (Thread) it.next();
+ log.info(t + " priority: " + t.getPriority());
+ assertEquals(Thread.NORM_PRIORITY, t.getPriority());
+ }
+
+ field = SocketServerInvoker.class.getDeclaredField("threadpool");
+ field.setAccessible(true);
+ List threadpool = (List) field.get((SocketServerInvoker) connector.getServerInvoker());
+ it = threadpool.iterator();
+ while (it.hasNext())
+ {
+ Thread t = (Thread) it.next();
+ log.info(t + " priority: " + t.getPriority());
+ assertEquals(Thread.NORM_PRIORITY, t.getPriority());
+ }
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+ public void testAcceptThreadPriorityInvalidValue() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Discover invalid thread priority value.
+ int invalidPriority = Thread.MAX_PRIORITY + 1;
+
+ // Start server.
+ setupServer(Integer.toString(invalidPriority));
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Test accept threads priority.
+ int defaultPriority = Thread.NORM_PRIORITY;
+ Field field = SocketServerInvoker.class.getDeclaredField("acceptThreads");
+ field.setAccessible(true);
+ Thread[] acceptThreads = (Thread[]) field.get((SocketServerInvoker) connector.getServerInvoker());
+ assertEquals(Integer.valueOf(NUM_ACCEPT_THREADS).intValue(), acceptThreads.length);
+ for (int i = 0; i < acceptThreads.length; i++)
+ {
+ log.info("acceptThreads[" + i + "].getPriority(): " + acceptThreads[i].getPriority());
+ assertEquals(defaultPriority, acceptThreads[i].getPriority());
+
+ }
+
+ // Test worker threads priority.
+ field = SocketServerInvoker.class.getDeclaredField("clientpool");
+ field.setAccessible(true);
+ LRUPool clientpool = (LRUPool) field.get((SocketServerInvoker) connector.getServerInvoker());
+ Iterator it = clientpool.getContents().iterator();
+ while (it.hasNext())
+ {
+ Thread t = (Thread) it.next();
+ log.info(t + " priority: " + t.getPriority());
+ assertEquals(Thread.NORM_PRIORITY, t.getPriority());
+ }
+
+ field = SocketServerInvoker.class.getDeclaredField("threadpool");
+ field.setAccessible(true);
+ List threadpool = (List) field.get((SocketServerInvoker) connector.getServerInvoker());
+ it = threadpool.iterator();
+ while (it.hasNext())
+ {
+ Thread t = (Thread) it.next();
+ log.info(t + " priority: " + t.getPriority());
+ assertEquals(Thread.NORM_PRIORITY, t.getPriority());
+ }
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+ protected String getTransport()
+ {
+ return "socket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer(String increment) throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ locatorURI += "/?numAcceptThreads=" + NUM_ACCEPT_THREADS;
+ locatorURI += "&acceptThreadPriorityIncrement=" + increment;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "&" + metadata;
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraServerConfig(config);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+}
\ No newline at end of file
13 years, 7 months
JBoss Remoting SVN: r6329 - remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM_1280_JBREM-1281.
by jboss-remoting-commits@lists.jboss.org
Author: jbertram(a)redhat.com
Date: 2011-04-18 15:53:41 -0400 (Mon, 18 Apr 2011)
New Revision: 6329
Modified:
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM_1280_JBREM-1281/build.xml
Log:
JBPAPP-6351
Modified: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM_1280_JBREM-1281/build.xml
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM_1280_JBREM-1281/build.xml 2011-04-18 19:51:56 UTC (rev 6328)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM_1280_JBREM-1281/build.xml 2011-04-18 19:53:41 UTC (rev 6329)
@@ -823,51 +823,6 @@
<target name="tests.functional.main.isJDK5" depends="tests.jars" if="isJDK5">
<mkdir dir="${output.tests.results}"/>
- <echo>http with ${version}: ${metadata}</echo>
- <junit printsummary="true" fork="yes" includeantruntime="true" maxmemory="1024m">
- <jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
- <jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
- <classpath>
- <path refid="${classpath}"/>
- <pathelement location="${output.lib.dir}/jboss-remoting-tests.jar"/>
- </classpath>
- <!-- set system properties required by JRunit -->
- <sysproperty key="jrunit.bind_addr" value="${bind.address}"/>
- <sysproperty key="jrunit.mcast_addr" value="${multicast.address}"/>
- <sysproperty key="jrunit.mcast_port" value="${multicast.port}"/>
- <sysproperty key="jrunit.receive_on_all_interfaces" value="${receiveOnAllInterfaces}"/>
- <sysproperty key="jrunit.send_on_all_interfaces" value="${sendOnAllInterfaces}"/>
- <sysproperty key="jrunit.send_interfaces" value="${sendInterfaces}"/>
- <sysproperty key="jrunit.logdir" value="${output.tests}"/>
- <sysproperty key="remoting.jar.dir" value="${basedir}/output/lib"/>
- <sysproperty key="ant.library.dir" value="${ant.library.dir}"/>
- <sysproperty key="build.home" value="${basedir}"/>
- <sysproperty key="jboss-junit-configuration" value="${jboss-junit-configuration}"/>
- <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
- extension="-${jboss-junit-configuration}.xml"/>
- <batchtest fork="yes" todir="${output.tests.results}"
- haltonfailure="no">
- <fileset dir="${tests.compile.dir}">
- <include name="**/remoting/**/coyote/**/*TestCase.class"/>
- <include name="**/remoting/**/coyote/**/*oyot*TestCase.class"/>
- <include name="**/remoting/**/http/**/*TestCase.class"/>
- <include name="**/remoting/**/*HTTP*TestCase.class"/>
- <include name="**/remoting/**/*Http*TestCase.class"/>
- <include name="**/remoting/**/*http*TestCase.class"/>
- <exclude name="**/remoting/**/HTTPSAsynchCallbackTestCase.class"/>
- <exclude name="**/remoting/**/HTTPInvokerClientTestCase.class"/>
- <exclude name="**/remoting/transport/http/compression/*CompressedHTTPInvokerTestCase*"/>
- <exclude name="**/remoting/**/performance/**"/>
- <exclude name="**/remoting/**/nonserializable/**"/>
- <exclude name="**/remoting/marshall/dynamic/remote/**/*TestCase.class"/>
- <exclude name="**/remoting/versioning/**/*TestCase.class"/>
- </fileset>
- </batchtest>
- </junit>
- </target>
-
- <target name="tests.functional.main.isJDK5" depends="tests.jars" if="isJDK5">
- <mkdir dir="${output.tests.results}"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
<jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
13 years, 7 months
JBoss Remoting SVN: r6328 - remoting2/branches.
by jboss-remoting-commits@lists.jboss.org
Author: jbertram(a)redhat.com
Date: 2011-04-18 15:51:56 -0400 (Mon, 18 Apr 2011)
New Revision: 6328
Added:
remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/
Log:
JBPAPP-6352
13 years, 7 months
JBoss Remoting SVN: r6327 - remoting2/branches.
by jboss-remoting-commits@lists.jboss.org
Author: jbertram(a)redhat.com
Date: 2011-04-18 15:42:21 -0400 (Mon, 18 Apr 2011)
New Revision: 6327
Added:
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM_1280_JBREM-1281/
Removed:
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/
Log:
JBPAPP-6351
13 years, 7 months
JBoss Remoting SVN: r6326 - in remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281: docs/guide/en and 20 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: jbertram(a)redhat.com
Date: 2011-04-18 15:35:57 -0400 (Mon, 18 Apr 2011)
New Revision: 6326
Added:
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/lib/jbossweb/
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/lib/jbossweb/README
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/lib/jbossweb/jbossweb.jar
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java
Removed:
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/lib/apache-tomcat/
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/lib/jbossweb/jbossweb.jar
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java
Modified:
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/build.xml
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/docs/guide/en/chap5.xml
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/ssl/RemotingSSLImplementation.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/connection/params/ConnectionValidatorConfigurationTestCase.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/ServletConfigurationMapTestClient.java
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF/
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/remoting-servlet-service.xml
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/remoting-servlet-service.xml
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/keystore
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/remoting-sslservlet-service.xml
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/truststore
Log:
JBPAPP-6351
Property changes on: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281
___________________________________________________________________
Added: svn:mergeinfo
+ /remoting2/branches/2.2:6177-6178,6226,6253,6261-6263,6266-6267,6271-6273,6281-6284,6291-6292,6297,6313-6320,6322-6324
Modified: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/build.xml
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/build.xml 2011-04-18 18:28:48 UTC (rev 6325)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/build.xml 2011-04-18 19:35:57 UTC (rev 6326)
@@ -142,7 +142,7 @@
<!-- Compile -->
<!-- ================================================================== -->
<target name="compile" description="Compile all source files." depends="configure">
-
+ <echo>${java.runtime.version}</echo>
<mkdir dir="${compile.dir}"/>
<!-- java source compile -->
@@ -153,8 +153,19 @@
deprecation="on"
optimize="off"
includes="**/*.java"
- failonerror="true">
+ failonerror="true"
+ sourcepath="">
<src path="${src.dir}"/>
+ <exclude name="org/jboss/remoting/transport/coyote/**" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/http/HTTPServerInvoker.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/http/TransportServerFactory.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/http/ssl/HTTPSServerInvoker.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/https/HTTPSServerInvoker.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/https/TransportServerFactory.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/servlet/ServletServerInvoker.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/servlet/TransportServerFactory.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/sslservlet/TransportServerFactory.java" if="isJDK4"/>
+ <exclude name="org/jboss/remoting/transport/web/WebServerInvoker.java" if="isJDK4"/>
<classpath refid="library.classpath"/>
</javac>
@@ -241,6 +252,13 @@
includes="**/*.java"
failonerror="true">
<src path="${tests.src.dir}"/>
+ <include name="**/*.java"/>
+ <exclude name="org/jboss/test/remoting/**/coyote/**" if="isJDK4"/>
+ <exclude name="org/jboss/test/remoting/**/http/**" if="isJDK4"/>
+ <exclude name="org/jboss/test/remoting/**/*HTTP*" if="isJDK4"/>
+ <exclude name="org/jboss/test/remoting/**/*Http*" if="isJDK4"/>
+ <exclude name="org/jboss/test/remoting/**/https/**" if="isJDK4"/>
+ <exclude name="org/jboss/test/remoting/**/servlet/**" if="isJDK4"/>
<classpath refid="tests.classpath"/>
</javac>
@@ -566,7 +584,9 @@
<target name="tests.functional.core" depends="configure">
<antcall target="tests.functional.serialization.java.core" inheritrefs="true"/>
+ <antcall target="tests.functional.serialization.java.http.core" inheritrefs="true"/>
<antcall target="tests.functional.serialization.jboss.core" inheritrefs="true"/>
+ <antcall target="tests.functional.serialization.jboss.http.core" inheritrefs="true"/>
</target>
<!-- calls functional main tests and marshall test with both java and jboss (if jdk1.5) serialization -->
@@ -692,6 +712,7 @@
</target>
<target name="tests.functional.main.core" depends="tests.jars">
+ <echo>bisocket/rmi/socket: ${metadata}</echo>
<mkdir dir="${output.tests.results}"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
@@ -707,6 +728,12 @@
haltonfailure="no">
<fileset dir="${tests.compile.dir}">
<include name="**/remoting/**/*TestCase.class"/>
+ <exclude name="**/remoting/**/coyote/**/*TestCase.class"/>
+ <exclude name="**/remoting/**/coyote/**/*oyot*TestCase.class"/>
+ <exclude name="**/remoting/**/http/**/*TestCase.class"/>
+ <exclude name="**/remoting/**/*HTTP*TestCase.class"/>
+ <exclude name="**/remoting/**/*Http*TestCase.class"/>
+ <exclude name="**/remoting/**/*http*TestCase.class"/>
<exclude name="**/remoting/**/ServerBindingTestCase.class"/>
<exclude name="**/remoting/marshall/dynamic/remote/**/*TestCase.class"/>
<exclude name="**/remoting/serialization/**/jboss/*TestCase.class"/>
@@ -728,9 +755,119 @@
</batchtest>
</junit>
</target>
+
+ <target name="tests.functional.serialization.java.http.core" unless="isJDK4">
+ <antcall target="tests.functional.http.jbossweb.core" inheritrefs="true">
+ <param name="serialization" value="java"/>
+ </antcall>
+ </target>
+
+ <target name="tests.functional.serialization.jboss.http.core" unless="isJDK4">
+ <antcall target="tests.functional.http.jbossweb.core" inheritrefs="true">
+ <param name="serialization" value="jboss"/>
+ </antcall>
+ </target>
+
+ <target name="tests.functional.http.jbossweb.core" unless="isJDK4">
+ <antcall target="tests.functional.main.http.core" inheritrefs="true">
+ <param name="remoting.metadata.key" value="remoting.metadata"/>
+ <param name="metadata" value="serializationtype=${serialization}"/>
+ <param name="jboss-junit-configuration" value="${serialization}_serialization_jbossweb"/>
+ <param name="classpath" value="tests.classpath"/>
+ <param name="version" value="jbossweb"/>
+ </antcall>
+ </target>
+
+ <target name="tests.functional.main.http.core">
+ <mkdir dir="${output.tests.results}"/>
+ <echo>http with ${version}: ${metadata}</echo>
+ <junit printsummary="true" fork="yes" includeantruntime="true" maxmemory="1024m">
+ <jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
+ <jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
+ <classpath>
+ <path refid="${classpath}"/>
+ <pathelement location="${output.lib.dir}/jboss-remoting-tests.jar"/>
+ </classpath>
+ <!-- set system properties required by JRunit -->
+ <sysproperty key="jrunit.bind_addr" value="${bind.address}"/>
+ <sysproperty key="jrunit.mcast_addr" value="${multicast.address}"/>
+ <sysproperty key="jrunit.mcast_port" value="${multicast.port}"/>
+ <sysproperty key="jrunit.receive_on_all_interfaces" value="${receiveOnAllInterfaces}"/>
+ <sysproperty key="jrunit.send_on_all_interfaces" value="${sendOnAllInterfaces}"/>
+ <sysproperty key="jrunit.send_interfaces" value="${sendInterfaces}"/>
+ <sysproperty key="jrunit.logdir" value="${output.tests}"/>
+ <sysproperty key="remoting.jar.dir" value="${basedir}/output/lib"/>
+ <sysproperty key="ant.library.dir" value="${ant.library.dir}"/>
+ <sysproperty key="build.home" value="${basedir}"/>
+ <sysproperty key="jboss-junit-configuration" value="${jboss-junit-configuration}"/>
+ <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+ extension="-${jboss-junit-configuration}.xml"/>
+ <batchtest fork="yes" todir="${output.tests.results}"
+ haltonfailure="no">
+ <fileset dir="${tests.compile.dir}">
+ <include name="**/remoting/**/http/**/*TestCase.class"/>
+ <include name="**/remoting/**/*HTTP*TestCase.class"/>
+ <include name="**/remoting/**/*Http*TestCase.class"/>
+ <include name="**/remoting/**/*http*TestCase.class"/>
+ <exclude name="**/remoting/**/HTTPSAsynchCallbackTestCase.class"/>
+ <exclude name="**/remoting/**/HTTPInvokerClientTestCase.class"/>
+ <exclude name="**/remoting/transport/http/compression/*CompressedHTTPInvokerTestCase*"/>
+ <exclude name="**/remoting/**/performance/**"/>
+ <exclude name="**/remoting/**/nonserializable/**"/>
+ <exclude name="**/remoting/marshall/dynamic/remote/**/*TestCase.class"/>
+ <exclude name="**/remoting/versioning/**/*TestCase.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
<target name="tests.functional.main.isJDK5" depends="tests.jars" if="isJDK5">
<mkdir dir="${output.tests.results}"/>
+ <echo>http with ${version}: ${metadata}</echo>
+ <junit printsummary="true" fork="yes" includeantruntime="true" maxmemory="1024m">
+ <jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
+ <jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
+ <classpath>
+ <path refid="${classpath}"/>
+ <pathelement location="${output.lib.dir}/jboss-remoting-tests.jar"/>
+ </classpath>
+ <!-- set system properties required by JRunit -->
+ <sysproperty key="jrunit.bind_addr" value="${bind.address}"/>
+ <sysproperty key="jrunit.mcast_addr" value="${multicast.address}"/>
+ <sysproperty key="jrunit.mcast_port" value="${multicast.port}"/>
+ <sysproperty key="jrunit.receive_on_all_interfaces" value="${receiveOnAllInterfaces}"/>
+ <sysproperty key="jrunit.send_on_all_interfaces" value="${sendOnAllInterfaces}"/>
+ <sysproperty key="jrunit.send_interfaces" value="${sendInterfaces}"/>
+ <sysproperty key="jrunit.logdir" value="${output.tests}"/>
+ <sysproperty key="remoting.jar.dir" value="${basedir}/output/lib"/>
+ <sysproperty key="ant.library.dir" value="${ant.library.dir}"/>
+ <sysproperty key="build.home" value="${basedir}"/>
+ <sysproperty key="jboss-junit-configuration" value="${jboss-junit-configuration}"/>
+ <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+ extension="-${jboss-junit-configuration}.xml"/>
+ <batchtest fork="yes" todir="${output.tests.results}"
+ haltonfailure="no">
+ <fileset dir="${tests.compile.dir}">
+ <include name="**/remoting/**/coyote/**/*TestCase.class"/>
+ <include name="**/remoting/**/coyote/**/*oyot*TestCase.class"/>
+ <include name="**/remoting/**/http/**/*TestCase.class"/>
+ <include name="**/remoting/**/*HTTP*TestCase.class"/>
+ <include name="**/remoting/**/*Http*TestCase.class"/>
+ <include name="**/remoting/**/*http*TestCase.class"/>
+ <exclude name="**/remoting/**/HTTPSAsynchCallbackTestCase.class"/>
+ <exclude name="**/remoting/**/HTTPInvokerClientTestCase.class"/>
+ <exclude name="**/remoting/transport/http/compression/*CompressedHTTPInvokerTestCase*"/>
+ <exclude name="**/remoting/**/performance/**"/>
+ <exclude name="**/remoting/**/nonserializable/**"/>
+ <exclude name="**/remoting/marshall/dynamic/remote/**/*TestCase.class"/>
+ <exclude name="**/remoting/versioning/**/*TestCase.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="tests.functional.main.isJDK5" depends="tests.jars" if="isJDK5">
+ <mkdir dir="${output.tests.results}"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
<jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
@@ -839,8 +976,14 @@
<!-- check to see if running jdk1.5 -->
<target name="get-jvm">
<condition property="isJDK5">
- <equals arg1="${ant.java.version}" arg2="1.5"/>
+ <or>
+ <equals arg1="${ant.java.version}" arg2="1.5"/>
+ <equals arg1="${ant.java.version}" arg2="1.6"/>
+ </or>
</condition>
+ <condition property="isJDK4">
+ <contains string="${java.runtime.version}" substring="1.4"/>
+ </condition>
</target>
<!-- This section is for quick smoke test of java vs. jboss serialization -->
@@ -1279,6 +1422,114 @@
</antcall>
<!-- ******************************************************************************** -->
+ <!-- Current <- -> 2.2.3.SP3 -->
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP3-client"/>
+ <param name="client.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP3/jboss-remoting.jar"/>
+ <param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value=""/>
+ <param name="server.version" value="2"/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="false"/>
+ <param name="serverImplementsServerIdentity" value="true"/>
+ </antcall>
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP3-server"/>
+ <param name="server.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP3/jboss-remoting.jar"/>
+ <param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value="2"/>
+ <param name="server.version" value=""/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="true"/>
+ <param name="serverImplementsServerIdentity" value="false"/>
+ </antcall>
+
+ <!-- ******************************************************************************** -->
+ <!-- Current <- -> 2.2.3.SP2 -->
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP2-client"/>
+ <param name="client.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP2/jboss-remoting.jar"/>
+ <param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value=""/>
+ <param name="server.version" value="2"/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="false"/>
+ <param name="serverImplementsServerIdentity" value="true"/>
+ </antcall>
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP2-server"/>
+ <param name="server.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP2/jboss-remoting.jar"/>
+ <param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value="2"/>
+ <param name="server.version" value=""/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="true"/>
+ <param name="serverImplementsServerIdentity" value="false"/>
+ </antcall>
+
+ <!-- ******************************************************************************** -->
+ <!-- Current <- -> 2.2.3.SP1 -->
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP1-client"/>
+ <param name="client.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP1/jboss-remoting.jar"/>
+ <param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value=""/>
+ <param name="server.version" value="2"/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="false"/>
+ <param name="serverImplementsServerIdentity" value="true"/>
+ </antcall>
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3_SP1-server"/>
+ <param name="server.classpath" value="${etc.dir}/lib/remoting_2_2_3_SP1/jboss-remoting.jar"/>
+ <param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value="2"/>
+ <param name="server.version" value=""/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="true"/>
+ <param name="serverImplementsServerIdentity" value="false"/>
+ </antcall>
+
+ <!-- ******************************************************************************** -->
+ <!-- Current <- -> 2.2.3 -->
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3-client"/>
+ <param name="client.classpath" value="${etc.dir}/lib/remoting_2_2_3/jboss-remoting.jar"/>
+ <param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value=""/>
+ <param name="server.version" value="2"/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="false"/>
+ <param name="serverImplementsServerIdentity" value="true"/>
+ </antcall>
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_3-server"/>
+ <param name="server.classpath" value="${etc.dir}/lib/remoting_2_2_3/jboss-remoting.jar"/>
+ <param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value="2"/>
+ <param name="server.version" value=""/>
+ <param name="check_connection" value="false"/>
+ <param name="clientImplementsServerIdentity" value="true"/>
+ <param name="serverImplementsServerIdentity" value="false"/>
+ </antcall>
+
+ <!-- ******************************************************************************** -->
<!-- Current <- -> 2.2.2.SP11 -->
<antcall target="tests.versioning.all_transports" inheritrefs="true">
<param name="jboss-junit-configuration" value="2_2_2_SP11-client"/>
Modified: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/docs/guide/en/chap5.xml
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/docs/guide/en/chap5.xml 2011-04-18 18:28:48 UTC (rev 6325)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/docs/guide/en/chap5.xml 2011-04-18 19:35:57 UTC (rev 6326)
@@ -1041,6 +1041,16 @@
<classname>java.net.SocketTimeoutException</classname>. If set to "true",
or if JBossSerialization is being used, the server thread will continue to wait for an invocation; otherwise, it
will return itself to the thread pool.</para>
+
+
+ <para><emphasis role="bold">acceptThreadPriorityIncrement</emphasis> - can
+ be used to increment the priority of the accept thread, which manages the
+ <classname>ServerSocket</classname>. The value is added to
+ <code>java.lang.Thread.NORM_PRIORITY</code>, and the resulting value must be
+ no more than <code>java.lang.Thread.MAX_PRIORITY</code>. This parameter might
+ be useful on a heavily loaded machine if the accept
+ thread is getting starved.
+ </para>
<bridgehead>Configurations affecting the Socket invoker
client</bridgehead>
@@ -2792,6 +2802,18 @@
<classname>BisocketServerInvoker</classname> uses it to govern the
number of attempts it should make to create both ordinary and control
sockets. The default value is 10. </para>
+
+
+ <para>Also, the parameter "acceptThreadPriorityIncrement", inherited from
+ <classname>org.jboss.remoting.transport.socket.SocketServerInvoker</classname>, can
+ be used to increment the priority of the thread that manages the secondary
+ <classname>ServerSocket</classname>. The value is added to
+ <code>java.lang.Thread.NORM_PRIORITY</code>, and the resulting value must be
+ no more than <code>java.lang.Thread.MAX_PRIORITY</code>. This parameter might
+ be useful on a heavily loaded machine if the secondary <classname>ServerSocket</classname>
+ thread is getting starved.
+ </para>
+
</section>
<section>
@@ -6705,5 +6727,17 @@
<para><emphasis role="bold">SERVER_SOCKET_CLASS_FLAG</emphasis> (actual
value is 'serverSocketClass') - specifies the fully qualified class name
for the custom SocketWrapper implementation to use on the server.</para>
- </section>
-</chapter>
\ No newline at end of file
+
+ <para><emphasis role="bold">Bean properties (meaning have getter/setter):</emphasis></para>
+
+ <para><emphasis role="bold">acceptThreadPriorityIncrement</emphasis> - can
+ be used to increment the priority of the accept thread, which manages the
+ <classname>ServerSocket</classname>. The value is added to
+ <code>java.lang.Thread.NORM_PRIORITY</code>, and the resulting value must be
+ no more than <code>java.lang.Thread.MAX_PRIORITY</code>. This parameter might
+ be useful on a heavily loaded machine if the accept
+ thread is getting starved.
+ </para>
+
+ </section>
+</chapter>
Copied: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/lib/jbossweb/README (from rev 6324, remoting2/branches/2.2/lib/jbossweb/README)
===================================================================
Deleted: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/lib/jbossweb/jbossweb.jar
===================================================================
(Binary files differ)
Copied: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/lib/jbossweb/jbossweb.jar (from rev 6315, remoting2/branches/2.2/lib/jbossweb/jbossweb.jar)
===================================================================
(Binary files differ)
Modified: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2011-04-18 18:28:48 UTC (rev 6325)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -646,9 +646,6 @@
protected LeasePinger getLeasePinger()
{
- synchronized(clientLeaseLock)
- {
- return leasePinger;
- }
+ return leasePinger;
}
}
Modified: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java 2011-04-18 18:28:48 UTC (rev 6325)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -76,4 +76,13 @@
*/
public static final String SECONDARY_BIND_PORT = "secondaryBindPort";
public static final String SECONDARY_CONNECT_PORT = "secondaryConnectPort";
+
+ /**
+ * Configuration keys and default values for parameters related to DOS attack
+ * on BisocketServerInvoker.SecondaryServerSocketThread
+ */
+ public static final String SECONDARY_MAX_THREADS = "secondaryMaxThreads";
+ public static final String SECONDARY_TIMEOUT = "secondaryTimeout";
+ public static final int SECONDARY_MAX_THREADS_DEFAULT = 50;
+ public static final int SECONDARY_TIMEOUT_DEFAULT = 60000;
}
Modified: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java 2011-04-18 18:28:48 UTC (rev 6325)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -53,7 +53,9 @@
import org.jboss.remoting.transport.socket.SocketServerInvoker;
import org.jboss.logging.Logger;
+import EDU.oswego.cs.dl.util.concurrent.Semaphore;
+
/**
*
* @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
@@ -85,6 +87,8 @@
protected boolean isCallbackServer = false;
protected int secondaryBindPort = -1;
protected int secondaryConnectPort = -1;
+ protected int dosMaxThreads = Bisocket.SECONDARY_MAX_THREADS_DEFAULT;
+ protected int dosTimeout = Bisocket.SECONDARY_TIMEOUT_DEFAULT;
public static BisocketServerInvoker getBisocketServerInvoker(String listenerId)
@@ -199,7 +203,9 @@
secondaryServerSocketThread = new SecondaryServerSocketThread(secondaryServerSocket);
secondaryServerSocketThread.setName("secondaryServerSocketThread");
secondaryServerSocketThread.setDaemon(true);
+ secondaryServerSocketThread.setPriority(Thread.NORM_PRIORITY + acceptThreadPriorityIncrement);
secondaryServerSocketThread.start();
+ log.debug("started SecondaryServerSocketThread with priority " + secondaryServerSocketThread.getPriority());
log.debug("started secondary port: " + host + ":" + secondaryBindPort);
}
}
@@ -358,6 +364,30 @@
}
+ public int getDosMaxThreads()
+ {
+ return dosMaxThreads;
+ }
+
+
+ public void setDosMaxThreads(int dosMaxThreads)
+ {
+ this.dosMaxThreads = dosMaxThreads;
+ }
+
+
+ public int getDosTimeout()
+ {
+ return dosTimeout;
+ }
+
+
+ public void setDosTimeout(int dosTimeout)
+ {
+ this.dosTimeout = dosTimeout;
+ }
+
+
public int getPingFrequency()
{
return pingFrequency;
@@ -509,6 +539,42 @@
log.warn("\"" + Bisocket.SECONDARY_CONNECT_PORT + "\" must be specified as a String");
}
+ o = configuration.get(Bisocket.SECONDARY_MAX_THREADS);
+ if (o instanceof String && ((String) o).length() > 0)
+ {
+ try
+ {
+ dosMaxThreads = Integer.valueOf(((String) o)).intValue();
+ log.debug(this + " setting dosMaxThreads to " + dosMaxThreads);
+ }
+ catch (NumberFormatException e)
+ {
+ log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_MAX_THREADS + "\": " + o);
+ }
+ }
+ else if (o != null)
+ {
+ log.warn("\"" + Bisocket.SECONDARY_MAX_THREADS + "\" must be specified as a String");
+ }
+
+ o = configuration.get(Bisocket.SECONDARY_TIMEOUT);
+ if (o instanceof String && ((String) o).length() > 0)
+ {
+ try
+ {
+ dosTimeout = Integer.valueOf(((String) o)).intValue();
+ log.debug(this + " setting dosTimeout to " + dosTimeout);
+ }
+ catch (NumberFormatException e)
+ {
+ log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_TIMEOUT + "\": " + o);
+ }
+ }
+ else if (o != null)
+ {
+ log.warn("\"" + Bisocket.SECONDARY_TIMEOUT + "\" must be specified as a String");
+ }
+
super.setup();
}
@@ -856,6 +922,8 @@
{
private ServerSocket secondaryServerSocket;
boolean running = true;
+ Semaphore maxThreads = new Semaphore(dosMaxThreads);
+ int localDosTimeout = dosTimeout;
SecondaryServerSocketThread(ServerSocket secondaryServerSocket) throws IOException
{
@@ -876,41 +944,7 @@
{
Socket socket = secondaryServerSocket.accept();
if (log.isTraceEnabled()) log.trace("accepted: " + socket);
- DataInputStream dis = new DataInputStream(socket.getInputStream());
- int action = dis.read();
- String listenerId = dis.readUTF();
-
- switch (action)
- {
- case Bisocket.CREATE_CONTROL_SOCKET:
- BisocketClientInvoker.transferSocket(listenerId, socket, true);
- if (log.isTraceEnabled())
- log.trace("SecondaryServerSocketThread: created control socket: (" + socket + ")"+ listenerId);
- break;
-
- case Bisocket.RECREATE_CONTROL_SOCKET:
- BisocketClientInvoker invoker = BisocketClientInvoker.getBisocketCallbackClientInvoker(listenerId);
- if (invoker == null)
- {
- log.error("received new control socket for unrecognized listenerId: " + listenerId);
- }
- else
- {
- invoker.replaceControlSocket(socket);
- if (log.isTraceEnabled())
- log.trace("SecondaryServerSocketThread: recreated control socket: " + listenerId);
- }
- break;
-
- case Bisocket.CREATE_ORDINARY_SOCKET:
- BisocketClientInvoker.transferSocket(listenerId, socket, false);
- if (log.isTraceEnabled())
- log.trace("SecondaryServerSocketThread: transferred socket: " + listenerId);
- break;
-
- default:
- log.error("unrecognized action on SecondaryServerSocketThread: " + action);
- }
+ processSocket(socket);
}
catch (IOException e)
{
@@ -923,6 +957,86 @@
}
}
+ void processSocket(final Socket socket) throws IOException
+ {
+ while (true)
+ {
+ try
+ {
+ maxThreads.acquire();
+ break;
+ }
+ catch (InterruptedException e1)
+ {
+ log.trace("unexpected interrupt");
+ }
+ }
+
+ new Thread()
+ {
+ public void run()
+ {
+ setName("processSocketThread: " + socket);
+ if (log.isTraceEnabled()) log.trace(this + " processing socket: " + socket);
+ try
+ {
+ socket.setSoTimeout(localDosTimeout);
+ DataInputStream dis = new DataInputStream(socket.getInputStream());
+ int action = dis.read();
+ String listenerId = dis.readUTF();
+
+ switch (action)
+ {
+ case Bisocket.CREATE_CONTROL_SOCKET:
+ BisocketClientInvoker.transferSocket(listenerId, socket, true);
+ if (log.isTraceEnabled())
+ log.trace("SecondaryServerSocketThread: created control socket: (" + socket + ")"+ listenerId);
+ break;
+
+ case Bisocket.RECREATE_CONTROL_SOCKET:
+ BisocketClientInvoker invoker = BisocketClientInvoker.getBisocketCallbackClientInvoker(listenerId);
+ if (invoker == null)
+ {
+ log.debug("received new control socket for unrecognized listenerId: " + listenerId);
+ }
+ else
+ {
+ invoker.replaceControlSocket(socket);
+ if (log.isTraceEnabled())
+ log.trace("SecondaryServerSocketThread: recreated control socket: " + listenerId);
+ }
+ break;
+
+ case Bisocket.CREATE_ORDINARY_SOCKET:
+ BisocketClientInvoker.transferSocket(listenerId, socket, false);
+ if (log.isTraceEnabled())
+ log.trace("SecondaryServerSocketThread: transferred socket: " + listenerId);
+ break;
+
+ default:
+ log.error("unrecognized action on SecondaryServerSocketThread: " + action);
+ }
+ }
+ catch (IOException e)
+ {
+ if (running)
+ {
+ log.error(this + " unable to process socket", e);
+ }
+ else
+ {
+ log.debug(this + " unable to process socket", e);
+ }
+ }
+ finally
+ {
+ if (log.isTraceEnabled()) log.trace(this + " processed socket: " + socket);
+ maxThreads.release();
+ }
+ }
+ }.start();
+ }
+
ServerSocket getServerSocket()
{
return secondaryServerSocket;
@@ -1066,4 +1180,4 @@
{
private static final long serialVersionUID = 2846502029152028732L;
}
-}
\ No newline at end of file
+}
Modified: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2011-04-18 18:28:48 UTC (rev 6325)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -17,15 +17,20 @@
package org.jboss.remoting.transport.coyote;
+import org.apache.catalina.Executor;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.core.StandardThreadExecutor;
import org.apache.coyote.ActionCode;
import org.apache.coyote.Adapter;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.Request;
+import org.apache.coyote.Response;
import org.apache.tomcat.util.buf.B2CConverter;
import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.buf.CharChunk;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
+import org.apache.tomcat.util.net.SocketStatus;
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.InvocationResponse;
import org.jboss.remoting.InvokerLocator;
@@ -49,6 +54,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -158,11 +164,12 @@
{
String key = (String) keys.next();
Object obj = config.get(key);
- if (obj instanceof String)
+ if ("executor".equals(key) && obj instanceof String)
{
- String val = (String) obj;
- setProperty(protocolHandler, key, val);
+ createAndSetExecutor(protocolHandler, (String) obj);
+ continue;
}
+ setProperty(protocolHandler, key, obj);
}
// need to convert standard remoting timeout config to tomcat timeout
@@ -894,7 +901,7 @@
* int or boolean we'll convert value to the right type before) - that means
* you can have setDebug(1).
*/
- public static boolean setProperty(Object o, String name, String value)
+ public static boolean setProperty(Object o, String name, Object value)
{
String setter = "set" + capitalize(name);
@@ -902,109 +909,144 @@
{
Method methods[] = o.getClass().getMethods();
Method setPropertyMethod = null;
+ Method setAttributeMethod = null;
+ Method setExecutorMethod = null;
- // First, the ideal case - a setFoo( String ) method
- for(int i = 0; i < methods.length; i++)
+ // Try a setFoo( String) or setFoo ( int ) or ( boolean )
+ if (value instanceof String)
{
- Class paramT[] = methods[i].getParameterTypes();
- if(setter.equals(methods[i].getName()) && paramT.length == 1
- && "java.lang.String".equals(paramT[0].getName()))
+ String stringValue = (String) value;
+ for(int i = 0; i < methods.length; i++)
{
+ boolean ok = true;
+ if(setter.equals(methods[i].getName())
+ && methods[i].getParameterTypes().length == 1)
+ {
- methods[i].invoke(o, new Object[]{value});
- return true;
- }
- }
+ // match - find the type and invoke it
+ Class paramType = methods[i].getParameterTypes()[0];
+ Object params[] = new Object[1];
- // Try a setFoo ( int ) or ( boolean )
- for(int i = 0; i < methods.length; i++)
- {
- boolean ok = true;
- if(setter.equals(methods[i].getName())
- && methods[i].getParameterTypes().length == 1)
- {
-
- // match - find the type and invoke it
- Class paramType = methods[i].getParameterTypes()[0];
- Object params[] = new Object[1];
-
- // Try a setFoo ( int )
- if("java.lang.Integer".equals(paramType.getName())
- || "int".equals(paramType.getName()))
- {
- try
+ // Try a setFoo ( String )
+ if("java.lang.String".equals(paramType.getName()))
{
- params[0] = new Integer(value);
+ params[0] = stringValue;
}
- catch(NumberFormatException ex)
+ // Try a setFoo ( int )
+ else if("java.lang.Integer".equals(paramType.getName())
+ || "int".equals(paramType.getName()))
{
- ok = false;
+ try
+ {
+ params[0] = new Integer(stringValue);
+ }
+ catch(NumberFormatException ex)
+ {
+ ok = false;
+ }
+ // Try a setFoo ( long )
}
- // Try a setFoo ( long )
- }
- else if("java.lang.Long".equals(paramType.getName())
- || "long".equals(paramType.getName()))
- {
- try
+ else if("java.lang.Long".equals(paramType.getName())
+ || "long".equals(paramType.getName()))
{
- params[0] = new Long(value);
+ try
+ {
+ params[0] = new Long(stringValue);
+ }
+ catch(NumberFormatException ex)
+ {
+ ok = false;
+ }
+
+ // Try a setFoo ( boolean )
}
- catch(NumberFormatException ex)
+ else if("java.lang.Boolean".equals(paramType.getName())
+ || "boolean".equals(paramType.getName()))
{
- ok = false;
+ params[0] = new Boolean(stringValue);
+
+ // Try a setFoo ( InetAddress )
}
+ else if("java.net.InetAddress".equals(paramType
+ .getName()))
+ {
+ try
+ {
+ params[0] = InetAddress.getByName(stringValue);
+ }
+ catch(UnknownHostException exc)
+ {
+ ok = false;
+ }
- // Try a setFoo ( boolean )
- }
- else if("java.lang.Boolean".equals(paramType.getName())
- || "boolean".equals(paramType.getName()))
- {
- params[0] = new Boolean(value);
+ // Unknown type
+ }
- // Try a setFoo ( InetAddress )
- }
- else if("java.net.InetAddress".equals(paramType
- .getName()))
- {
- try
+ if(ok)
{
- params[0] = InetAddress.getByName(value);
+ methods[i].invoke(o, params);
+ return true;
}
- catch(UnknownHostException exc)
- {
- ok = false;
- }
-
- // Unknown type
}
-
- if(ok)
+ // save "setProperty" for later
+ if ("setAttribute".equals(methods[i].getName()))
{
- methods[i].invoke(o, params);
- return true;
+ setAttributeMethod = methods[i];
}
+ else if("setProperty".equals(methods[i].getName()))
+ {
+ setPropertyMethod = methods[i];
+ }
}
-
- // save "setProperty" for later
- if("setProperty".equals(methods[i].getName()))
+ }
+ else
+ {
+ for(int i = 0; i < methods.length; i++)
{
- setPropertyMethod = methods[i];
+ // save "setProperty" for later
+ if ("setAttribute".equals(methods[i].getName()))
+ {
+ setAttributeMethod = methods[i];
+ }
+ else if("setProperty".equals(methods[i].getName()))
+ {
+ setPropertyMethod = methods[i];
+ }
+ else if ("setExecutor".equals(methods[i].getName()))
+ {
+ setExecutorMethod = methods[i];
+ }
}
}
- // Ok, no setXXX found, try a setProperty("name", "value")
- if(setPropertyMethod != null)
+ // Ok, no setXXX found, try a setProperty("name", "value") or setAttribute("name", "value")
+ if(setExecutorMethod != null && value instanceof Executor)
{
+ Object params[] = new Object[1];
+ params[0] = value;
+ setExecutorMethod.invoke(o, params);
+ return true;
+ }
+ else if(setAttributeMethod != null)
+ {
Object params[] = new Object[2];
params[0] = name;
params[1] = value;
+ setAttributeMethod.invoke(o, params);
+ return true;
+ }
+ else if(setPropertyMethod != null)
+ {
+ Object params[] = new Object[2];
+ params[0] = name;
+ params[1] = value;
setPropertyMethod.invoke(o, params);
return true;
}
-
}
catch(Exception e)
{
+ log.debug("unable to set property " + name + " to " + value + ": " + e.getMessage());
return false;
}
return false;
@@ -1024,4 +1066,37 @@
return new String(chars);
}
+
+ static private void createAndSetExecutor(ProtocolHandler protocolHandler, String executorConfig)
+ {
+ Executor executor = new StandardThreadExecutor();
+ log.debug("setting executor to " + executor + " with properties:");
+ if (executorConfig != null)
+ {
+ String[] ss = executorConfig.split(",");
+ for (int i = 0; i < ss.length; i++)
+ {
+ int pos = ss[i].indexOf('=');
+ setProperty(executor, ss[i].substring(0, pos).trim(), ss[i].substring(pos + 1).trim());
+ log.debug(ss[i].substring(0, pos).trim() + ": " + ss[i].substring(pos + 1).trim());
+ }
+ }
+
+ try
+ {
+ executor.start();
+ }
+ catch (LifecycleException e)
+ {
+ log.warn("unable to start executor " + executor, e);
+ return;
+ }
+
+ setProperty(protocolHandler, "executor", executor);
+ }
+
+ public boolean event(Request req, Response res, SocketStatus status) throws Exception
+ {
+ return false;
+ }
}
Modified: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/ssl/RemotingSSLImplementation.java
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/ssl/RemotingSSLImplementation.java 2011-04-18 18:28:48 UTC (rev 6325)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/ssl/RemotingSSLImplementation.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -26,6 +26,7 @@
import java.util.HashMap;
import java.util.Map;
import javax.management.MBeanServer;
+import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import org.apache.tomcat.util.net.SSLImplementation;
import org.apache.tomcat.util.net.SSLSupport;
@@ -63,4 +64,9 @@
{
mbeanServerMap.put(locator, mBeanServer);
}
+
+ public SSLSupport getSSLSupport(SSLSession arg0)
+ {
+ return null;
+ }
}
\ No newline at end of file
Modified: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2011-04-18 18:28:48 UTC (rev 6325)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -86,6 +86,7 @@
protected int maxPoolSize = MAX_POOL_SIZE_DEFAULT;
protected LRUPool clientpool;
protected LinkedList threadpool;
+ protected int acceptThreadPriorityIncrement = 0;
protected boolean newServerSocketFactory = false;
protected Object serverSocketFactoryLock = new Object();
@@ -212,8 +213,10 @@
String name = getThreadName(i);
acceptThreads[i] = new Thread(this, name);
+ acceptThreads[i].setPriority(Thread.NORM_PRIORITY + acceptThreadPriorityIncrement);
- if(trace) { log.trace(this + " created and registered " + acceptThreads[i]); }
+ if(trace) { log.trace(this + " created and registered " + acceptThreads[i]
+ + " with priority " + acceptThreads[i].getPriority()); }
}
}
@@ -499,6 +502,24 @@
}
}
+ public int getAcceptThreadPriorityIncrement()
+ {
+ return acceptThreadPriorityIncrement;
+ }
+
+ public void setAcceptThreadPriorityIncrement(int acceptThreadPriorityIncrement)
+ {
+ int resultingPriority = Thread.NORM_PRIORITY + acceptThreadPriorityIncrement;
+ if (resultingPriority < Thread.MIN_PRIORITY || resultingPriority > Thread.MAX_PRIORITY)
+ {
+ log.warn(this + " resulting priority out of range: " + resultingPriority);
+ }
+ else
+ {
+ this.acceptThreadPriorityIncrement = acceptThreadPriorityIncrement;
+ }
+ }
+
public void run()
{
if(trace) { log.trace(this + " started execution of method run()"); }
@@ -595,8 +616,9 @@
worker = new ServerThread(socket, this, clientpool, threadpool,
getTimeout(), serverSocketClass);
+ worker.setPriority(Thread.NORM_PRIORITY);
- if(trace) { log.trace(this + " created " + worker); }
+ if(trace) { log.trace(this + " created " + worker + " with priority " + worker.getPriority()); }
newThread = true;
}
Property changes on: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/connection/params/ConnectionValidatorConfigurationTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Deleted: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java 2011-03-19 20:51:35 UTC (rev 6284)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -1,217 +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.bisocket.accept;
-
-import java.lang.reflect.Field;
-import java.net.InetAddress;
-import java.util.HashMap;
-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.bisocket.BisocketServerInvoker;
-import org.jboss.remoting.transport.socket.SocketServerInvoker;
-
-
-/**
- * Unit tests for JBREM-1277
- *
- * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1 $
- * <p>
- * Copyright Mar 19, 2011
- */
-public class SecondaryAcceptThreadPriorityTestCase extends TestCase
-{
- protected static String NUM_ACCEPT_THREADS = "3";
- protected static String PRIORITY_INCREMENT = "4";
-
- private static Logger log = Logger.getLogger(SecondaryAcceptThreadPriorityTestCase.class);
-
- private static boolean firstTime = 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 = false;
- Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
- Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
- String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
- PatternLayout layout = new PatternLayout(pattern);
- ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- Logger.getRootLogger().addAppender(consoleAppender);
- }
- }
-
-
- public void tearDown()
- {
- }
-
-
- public void testAcceptThreadPriority() throws Throwable
- {
- log.info("entering " + getName());
-
- // Start server.
- setupServer(PRIORITY_INCREMENT);
-
- // Create client.
- InvokerLocator clientLocator = new InvokerLocator(locatorURI);
- HashMap clientConfig = new HashMap();
- clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraClientConfig(clientConfig);
- Client client = new Client(clientLocator, clientConfig);
- client.connect();
- log.info("client is connected");
-
- // Test connections.
- assertEquals("abc", client.invoke("abc"));
- log.info("connection is good");
-
- // Test accept threads priority.
- int defaultPriority = Thread.NORM_PRIORITY;
- int expectedPriority = defaultPriority + Integer.valueOf(PRIORITY_INCREMENT).intValue();
- Field field = BisocketServerInvoker.class.getDeclaredField("secondaryServerSocketThread");
- field.setAccessible(true);
- Thread secondaryServerSocketThread = (Thread) field.get((BisocketServerInvoker) connector.getServerInvoker());
- assertEquals(expectedPriority, secondaryServerSocketThread.getPriority());
-
- client.disconnect();
- shutdownServer();
- log.info(getName() + " PASSES");
- }
-
- public void testAcceptThreadPriorityInvalidValue() throws Throwable
- {
- log.info("entering " + getName());
-
- // Discover invalid thread priority value.
- int invalidPriority = Thread.MAX_PRIORITY + 1;
-
- // Start server.
- setupServer(Integer.toString(invalidPriority));
-
- // Create client.
- InvokerLocator clientLocator = new InvokerLocator(locatorURI);
- HashMap clientConfig = new HashMap();
- clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraClientConfig(clientConfig);
- Client client = new Client(clientLocator, clientConfig);
- client.connect();
- log.info("client is connected");
-
- // Test connections.
- assertEquals("abc", client.invoke("abc"));
- log.info("connection is good");
-
- // Test accept threads priority.
- int defaultPriority = Thread.NORM_PRIORITY;
- Field field = BisocketServerInvoker.class.getDeclaredField("secondaryServerSocketThread");
- field.setAccessible(true);
- Thread secondaryServerSocketThread = (Thread) field.get((BisocketServerInvoker) connector.getServerInvoker());
- assertEquals(defaultPriority, secondaryServerSocketThread.getPriority());
-
- client.disconnect();
- shutdownServer();
- log.info(getName() + " PASSES");
- }
-
- protected String getTransport()
- {
- return "bisocket";
- }
-
-
- protected void addExtraClientConfig(Map config) {}
- protected void addExtraServerConfig(Map config) {}
-
-
- protected void setupServer(String increment) throws Exception
- {
- host = InetAddress.getLocalHost().getHostAddress();
- port = PortUtil.findFreePort(host);
- locatorURI = getTransport() + "://" + host + ":" + port;
- locatorURI += "/?numAcceptThreads=" + NUM_ACCEPT_THREADS;
- locatorURI += "&acceptThreadPriorityIncrement=" + increment;
- String metadata = System.getProperty("remoting.metadata");
- if (metadata != null)
- {
- locatorURI += "&" + metadata;
- }
- serverLocator = new InvokerLocator(locatorURI);
- log.info("Starting remoting server with locator uri of: " + locatorURI);
- HashMap config = new HashMap();
- config.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraServerConfig(config);
- connector = new Connector(serverLocator, config);
- connector.create();
- invocationHandler = new TestInvocationHandler();
- connector.addInvocationHandler("test", invocationHandler);
- connector.start();
- }
-
-
- protected void shutdownServer() throws Exception
- {
- if (connector != null)
- connector.stop();
- }
-
-
- static class TestInvocationHandler implements ServerInvocationHandler
- {
- public void addListener(InvokerCallbackHandler callbackHandler) {}
- public Object invoke(final InvocationRequest invocation) throws Throwable
- {
- 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_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java (from rev 6284, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java)
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java (rev 0)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/accept/SecondaryAcceptThreadPriorityTestCase.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -0,0 +1,217 @@
+/*
+ * 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.bisocket.accept;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+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.bisocket.BisocketServerInvoker;
+import org.jboss.remoting.transport.socket.SocketServerInvoker;
+
+
+/**
+ * Unit tests for JBREM-1277
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Mar 19, 2011
+ */
+public class SecondaryAcceptThreadPriorityTestCase extends TestCase
+{
+ protected static String NUM_ACCEPT_THREADS = "3";
+ protected static String PRIORITY_INCREMENT = "4";
+
+ private static Logger log = Logger.getLogger(SecondaryAcceptThreadPriorityTestCase.class);
+
+ private static boolean firstTime = 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 = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testAcceptThreadPriority() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(PRIORITY_INCREMENT);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Test accept threads priority.
+ int defaultPriority = Thread.NORM_PRIORITY;
+ int expectedPriority = defaultPriority + Integer.valueOf(PRIORITY_INCREMENT).intValue();
+ Field field = BisocketServerInvoker.class.getDeclaredField("secondaryServerSocketThread");
+ field.setAccessible(true);
+ Thread secondaryServerSocketThread = (Thread) field.get((BisocketServerInvoker) connector.getServerInvoker());
+ assertEquals(expectedPriority, secondaryServerSocketThread.getPriority());
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+ public void testAcceptThreadPriorityInvalidValue() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Discover invalid thread priority value.
+ int invalidPriority = Thread.MAX_PRIORITY + 1;
+
+ // Start server.
+ setupServer(Integer.toString(invalidPriority));
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Test accept threads priority.
+ int defaultPriority = Thread.NORM_PRIORITY;
+ Field field = BisocketServerInvoker.class.getDeclaredField("secondaryServerSocketThread");
+ field.setAccessible(true);
+ Thread secondaryServerSocketThread = (Thread) field.get((BisocketServerInvoker) connector.getServerInvoker());
+ assertEquals(defaultPriority, secondaryServerSocketThread.getPriority());
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+ protected String getTransport()
+ {
+ return "bisocket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer(String increment) throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ locatorURI += "/?numAcceptThreads=" + NUM_ACCEPT_THREADS;
+ locatorURI += "&acceptThreadPriorityIncrement=" + increment;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "&" + metadata;
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraServerConfig(config);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+}
\ No newline at end of file
Deleted: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java 2010-12-18 02:23:26 UTC (rev 6178)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -1,287 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, 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.bisocket.dos;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-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.Callback;
-import org.jboss.remoting.callback.HandleCallbackException;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.transport.Connector;
-import org.jboss.remoting.transport.PortUtil;
-import org.jboss.remoting.transport.bisocket.Bisocket;
-
-/**
- * @author <a href="mailto:ron.sigal@jboss.com">Ron Sigal</a>
- * @version $Rev$
- * <p>
- * Copyright Oct 13, 2010
- * </p>
- */
-public class DosTestCase extends TestCase
-{
- private static final Logger log = Logger.getLogger(DosTestCase.class);
- private static final String CALLBACK_TEST = "callbackTest";
-
- private static boolean firstTime = true;
-
- protected String host;
- protected int port;
- protected int secondaryPort;
- protected String locatorURI;
- protected InvokerLocator serverLocator;
- protected Connector connector;
- protected TestInvocationHandler invocationHandler;
- protected Object lock = new Object();
- protected boolean dosAttackThreadRan;
- protected boolean secondCallbackRan;
-
-
- public void setUp() throws Exception
- {
- if (firstTime)
- {
- firstTime = false;
- Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO);
- Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
- String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
- PatternLayout layout = new PatternLayout(pattern);
- ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- Logger.getRootLogger().addAppender(consoleAppender);
- }
- }
-
-
- public void tearDown()
- {
- }
-
- public void testDosAttack() throws Throwable
- {
- log.info("entering " + getName());
-
- // Start server.
- setupServer();
-
- // Create client.
- HashMap clientConfig = new HashMap();
- clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraClientConfig(clientConfig);
- final Client client = new Client(serverLocator, clientConfig);
- client.connect();
- assertEquals("abc", client.invoke("abc"));
- log.info("client is connected");
-
- // Add callback handler.
- TestCallbackHandler callbackHandler = new TestCallbackHandler();
- HashMap metadata = new HashMap();
- metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
- client.addListener(callbackHandler, metadata);
- client.invoke(CALLBACK_TEST);
- assertEquals(1, callbackHandler.counter);
- log.info("callback handler is installed");
-
- // Test DOS attack.
- new Thread()
- {
- public void run()
- {
- try
- {
- Socket s = new Socket(host, secondaryPort);
- log.info(this + " created socket " + s);
- synchronized (lock)
- {
- dosAttackThreadRan = true;
- }
- }
- catch (IOException e)
- {
- log.error("unable to connect to secondaryPort: " + secondaryPort, e);
- }
- finally
- {
- synchronized (lock)
- {
- lock.notifyAll();
- }
- }
- }
- }.start();
-
- Thread.sleep(2000);
-
- synchronized (lock)
- {
- if (!dosAttackThreadRan)
- {
- long start = System.currentTimeMillis();
- long end = start + 10000;
- while (end - System.currentTimeMillis() > 0)
- {
- try
- {
- lock.wait(end - System.currentTimeMillis());
- }
- catch (InterruptedException e){
-
- }
- }
- }
- }
-
- if (!dosAttackThreadRan)
- {
- fail("DOS attack thread did not run");
- }
-
-
- // DOS attack has occurred. Try to add another callback handler.
- new Thread()
- {
- public void run()
- {
- TestCallbackHandler callbackHandler2 = new TestCallbackHandler();
- try
- {
-
- HashMap metadata = new HashMap();
- metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
- client.addListener(callbackHandler2, metadata);
- secondCallbackRan = true;
- log.info(this + " second callback handler installed after DOS attack");
- }
- catch (Throwable e)
- {
- log.info(this + " second callback failed", e);
- }
- }
- }.start();
-
- Thread.sleep(10000);
- assertTrue(secondCallbackRan);
-
- client.removeListener(callbackHandler);
- client.disconnect();
- connector.stop();
- }
-
- protected String getTransport()
- {
- return "bisocket";
- }
-
-
- protected void addExtraClientConfig(Map config) {}
- protected void addExtraServerConfig(Map config) {}
-
-
- protected void setupServer() throws Exception
- {
- host = InetAddress.getLocalHost().getHostAddress();
- port = PortUtil.findFreePort(host);
- secondaryPort = PortUtil.findFreePort(host);
- locatorURI = getTransport() + "://" + host + ":" + port + "/?secondaryBindPort=" + secondaryPort;
- String metadata = System.getProperty("remoting.metadata");
- if (metadata != null)
- {
- locatorURI += "&" + metadata;
- }
- serverLocator = new InvokerLocator(locatorURI);
- log.info("Starting remoting server with locator uri of: " + locatorURI);
- HashMap config = new HashMap();
- config.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraServerConfig(config);
- connector = new Connector(serverLocator, config);
- connector.create();
- invocationHandler = new TestInvocationHandler();
- connector.addInvocationHandler("test", invocationHandler);
- connector.start();
- }
-
-
- protected void shutdownServer() throws Exception
- {
- if (connector != null)
- connector.stop();
- }
-
-
-
- static class TestInvocationHandler implements ServerInvocationHandler
- {
- public Set listeners = new HashSet();
-
- public void addListener(InvokerCallbackHandler callbackHandler)
- {
- listeners.add(callbackHandler);
- }
- public Object invoke(final InvocationRequest invocation) throws Throwable
- {
- if (CALLBACK_TEST.equals(invocation.getParameter()))
- {
- Iterator it = listeners.iterator();
- while (it.hasNext())
- {
- InvokerCallbackHandler handler = (InvokerCallbackHandler) it.next();
- handler.handleCallback(new Callback("test"));
- log.info(this + " sent callback");
- }
- }
- return invocation.getParameter();
- }
- public void removeListener(InvokerCallbackHandler callbackHandler) {}
- public void setMBeanServer(MBeanServer server) {}
- public void setInvoker(ServerInvoker invoker) {}
- }
-
- static class TestCallbackHandler implements InvokerCallbackHandler
- {
- public int counter;
-
- public void handleCallback(Callback callback) throws HandleCallbackException
- {
- log.info(this + " received callback");
- counter++;
- }
- }
-}
\ No newline at end of file
Copied: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java (from rev 6178, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java)
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java (rev 0)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -0,0 +1,392 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, 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.bisocket.dos;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+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.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.bisocket.Bisocket;
+import org.jboss.remoting.transport.bisocket.BisocketServerInvoker;
+
+import EDU.oswego.cs.dl.util.concurrent.Semaphore;
+
+/**
+ * @author <a href="mailto:ron.sigal@jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Oct 13, 2010
+ * </p>
+ */
+public class DosTestCase extends TestCase
+{
+ private static final Logger log = Logger.getLogger(DosTestCase.class);
+ private static final String CALLBACK_TEST = "callbackTest";
+ private static final int dosMaxThreadsValue = 49;
+ private static final int dosTimeoutValue = 59;
+
+ private static boolean firstTime = true;
+
+ protected String host;
+ protected int port;
+ protected int secondaryPort;
+ protected String locatorURI;
+ protected InvokerLocator serverLocator;
+ protected Connector connector;
+ protected TestInvocationHandler invocationHandler;
+ protected Object lock = new Object();
+ protected boolean dosAttackThreadRan;
+ protected boolean secondCallbackRan;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+ public void testDosAttack() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(false, false);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ final Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ assertEquals("abc", client.invoke("abc"));
+ log.info("client is connected");
+
+ // Add callback handler.
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ HashMap metadata = new HashMap();
+ metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+ client.addListener(callbackHandler, metadata);
+ client.invoke(CALLBACK_TEST);
+ assertEquals(1, callbackHandler.counter);
+ log.info("callback handler is installed");
+
+ // Test DOS attack.
+ new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ Socket s = new Socket(host, secondaryPort);
+ log.info(this + " created socket " + s);
+ synchronized (lock)
+ {
+ dosAttackThreadRan = true;
+ }
+ }
+ catch (IOException e)
+ {
+ log.error("unable to connect to secondaryPort: " + secondaryPort, e);
+ }
+ finally
+ {
+ synchronized (lock)
+ {
+ lock.notifyAll();
+ }
+ }
+ }
+ }.start();
+
+ Thread.sleep(2000);
+
+ synchronized (lock)
+ {
+ if (!dosAttackThreadRan)
+ {
+ long start = System.currentTimeMillis();
+ long end = start + 10000;
+ while (end - System.currentTimeMillis() > 0)
+ {
+ try
+ {
+ lock.wait(end - System.currentTimeMillis());
+ }
+ catch (InterruptedException e){
+
+ }
+ }
+ }
+ }
+
+ if (!dosAttackThreadRan)
+ {
+ fail("DOS attack thread did not run");
+ }
+
+
+ // DOS attack has occurred. Try to add another callback handler.
+ new Thread()
+ {
+ public void run()
+ {
+ TestCallbackHandler callbackHandler2 = new TestCallbackHandler();
+ try
+ {
+
+ HashMap metadata = new HashMap();
+ metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+ client.addListener(callbackHandler2, metadata);
+ secondCallbackRan = true;
+ log.info(this + " second callback handler installed after DOS attack");
+ }
+ catch (Throwable e)
+ {
+ log.info(this + " second callback failed", e);
+ }
+ }
+ }.start();
+
+ Thread.sleep(10000);
+ assertTrue(secondCallbackRan);
+
+ client.removeListener(callbackHandler);
+ client.disconnect();
+ connector.stop();
+ }
+
+
+ public void testConfigurationDefault() throws Throwable
+ {
+ log.info("entering " + getName());
+ doConfigurationTest(false, false, Bisocket.SECONDARY_MAX_THREADS_DEFAULT, Bisocket.SECONDARY_TIMEOUT_DEFAULT);
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testConfigurationMap() throws Throwable
+ {
+ log.info("entering " + getName());
+ doConfigurationTest(true, false, dosMaxThreadsValue, dosTimeoutValue);
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testConfigurationInvokerLocater() throws Throwable
+ {
+ log.info("entering " + getName());
+ doConfigurationTest(true, true, dosMaxThreadsValue, dosTimeoutValue);
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected void doConfigurationTest(boolean setParameters, boolean useInvokerLocator, int threadCount, int timeout) throws Throwable
+ {
+ // Start server.
+ setupServer(setParameters, useInvokerLocator);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ final Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ assertEquals("abc", client.invoke("abc"));
+ log.info("client is connected");
+
+ // Add callback handler.
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ HashMap metadata = new HashMap();
+ metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+ client.addListener(callbackHandler, metadata);
+ client.invoke(CALLBACK_TEST);
+ assertEquals(1, callbackHandler.counter);
+ log.info("callback handler is installed");
+
+ BisocketServerInvoker invoker = (BisocketServerInvoker) connector.getServerInvoker();
+ assertEquals(threadCount, invoker.getDosMaxThreads());
+ assertEquals(timeout, invoker.getDosTimeout());
+ verifyThreadValues(invoker, threadCount, timeout);
+
+ client.removeListener(callbackHandler);
+ client.disconnect();
+ connector.stop();
+ }
+
+
+ protected boolean verifyThreadValues(ServerInvoker invoker, int threadCount, int timeout) throws Exception
+ {
+ Class[] classes = BisocketServerInvoker.class.getDeclaredClasses();
+ Class threadClass = null;
+ for (int i = 0; i < classes.length; i++)
+ {
+ if (classes[i].getName().indexOf("SecondaryServerSocketThread") > -1)
+ {
+ threadClass = classes[i];
+ break;
+ }
+ }
+ log.info("threadClass: " + threadClass);
+ Field field = BisocketServerInvoker.class.getDeclaredField("secondaryServerSocketThread");
+ field.setAccessible(true);
+ Thread secondaryServerSocketThread = (Thread) field.get(invoker);
+ Field maxThreads = threadClass.getDeclaredField("maxThreads");
+ maxThreads.setAccessible(true);
+ Field localDosTimeout = threadClass.getDeclaredField("localDosTimeout");
+ localDosTimeout.setAccessible(true);
+
+ assertEquals(threadCount, ((Semaphore)maxThreads.get(secondaryServerSocketThread)).permits());
+ assertEquals(timeout, ((Integer)localDosTimeout.get(secondaryServerSocketThread)).intValue());
+ return true;
+ }
+
+
+ protected String getTransport()
+ {
+ return "bisocket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer(boolean setParameters, boolean useInvokerLocator) throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ secondaryPort = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port + "/?secondaryBindPort=" + secondaryPort;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "&" + metadata;
+ }
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraServerConfig(config);
+ if (setParameters)
+ {
+ if (useInvokerLocator)
+ {
+ locatorURI += "&" + Bisocket.SECONDARY_MAX_THREADS + "=" + Integer.toString(dosMaxThreadsValue);
+ locatorURI += "&" + Bisocket.SECONDARY_TIMEOUT + "=" + Integer.toString(dosTimeoutValue);
+ }
+ else
+ {
+ config.put(Bisocket.SECONDARY_MAX_THREADS, Integer.toString(dosMaxThreadsValue));
+ config.put(Bisocket.SECONDARY_TIMEOUT, Integer.toString(dosTimeoutValue));
+ }
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public Set listeners = new HashSet();
+
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ listeners.add(callbackHandler);
+ }
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ if (CALLBACK_TEST.equals(invocation.getParameter()))
+ {
+ Iterator it = listeners.iterator();
+ while (it.hasNext())
+ {
+ InvokerCallbackHandler handler = (InvokerCallbackHandler) it.next();
+ handler.handleCallback(new Callback("test"));
+ log.info(this + " sent callback");
+ }
+ }
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+
+ static class TestCallbackHandler implements InvokerCallbackHandler
+ {
+ public int counter;
+
+ public void handleCallback(Callback callback) throws HandleCallbackException
+ {
+ log.info(this + " received callback");
+ counter++;
+ }
+ }
+}
\ No newline at end of file
Deleted: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java 2011-04-13 20:36:28 UTC (rev 6315)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -1,189 +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.coyote;
-
-import java.lang.reflect.Field;
-import java.net.InetAddress;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-
-import junit.framework.TestCase;
-
-import org.apache.coyote.http11.Http11Protocol;
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-import org.jboss.logging.XLevel;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.transport.Connector;
-import org.jboss.remoting.transport.PortUtil;
-import org.jboss.remoting.transport.coyote.CoyoteInvoker;
-
-
-/**
- * Unit test for JBREM-1281
- *
- * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1 $
- * <p>
- * Copyright Apr 13, 2011
- */
-public class SetAttributeTestCase extends TestCase
-{
- private static Logger log = Logger.getLogger(SetAttributeTestCase.class);
-
- private static boolean firstTime = 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 = false;
- Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
- Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
- String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
- PatternLayout layout = new PatternLayout(pattern);
- ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- Logger.getRootLogger().addAppender(consoleAppender);
- }
- }
-
-
- public void tearDown()
- {
- }
-
-
- public void testSetExecutor() throws Throwable
- {
- log.info("entering " + getName());
-
- // Start server.
- host = InetAddress.getLocalHost().getHostAddress();
- port = PortUtil.findFreePort(host);
- locatorURI = getTransport() + "://" + host + ":" + port;
- String metadata = System.getProperty("remoting.metadata");
- if (metadata != null)
- {
- locatorURI += "/?" + metadata;
- }
- serverLocator = new InvokerLocator(locatorURI);
- log.info("Starting remoting server with locator uri of: " + locatorURI);
- HashMap config = new HashMap();
- config.put(InvokerLocator.FORCE_REMOTE, "true");
-
- // Attributes set directly on Http11Protocol
- config.put("maxSavePostSize", "3");
- config.put("keepAlive", "false");
- config.put("compression", "on");
- config.put("testObject", new TestObject(5));
-
- // Attributes set on Http11Protocol.endpoint
- config.put("soTimeout", "7");
- config.put("tcpNoDelay", "true");
- config.put("address", InetAddress.getLocalHost());
-
- connector = new Connector(serverLocator, config);
- connector.create();
- invocationHandler = new TestInvocationHandler();
- connector.addInvocationHandler("test", invocationHandler);
- connector.start();
- CoyoteInvoker invoker = (CoyoteInvoker) connector.getServerInvoker();
- Field field = CoyoteInvoker.class.getDeclaredField("protocolHandler");
- field.setAccessible(true);
- Http11Protocol protocolHandler = (Http11Protocol) field.get(invoker);
- log.info("maxSavePostSize: " + protocolHandler.getMaxSavePostSize());
- log.info("keepAlive: " + protocolHandler.getKeepAlive());
- log.info("compression: " + protocolHandler.getCompression());
- log.info("testObject: " + protocolHandler.getAttribute("testObject"));
-
- log.info("soTimeout: " + protocolHandler.getSoTimeout());
- log.info("tcpNoDelay: " + protocolHandler.getTcpNoDelay());
- log.info("address: " + protocolHandler.getAddress());
-
- assertEquals(new Integer(3), new Integer(protocolHandler.getMaxSavePostSize()));
- assertEquals(Boolean.FALSE, new Boolean(protocolHandler.getKeepAlive()));
- assertEquals("on", protocolHandler.getCompression());
- assertEquals(new TestObject(5), protocolHandler.getAttribute("testObject"));
-
- assertEquals(new Integer(7), new Integer(protocolHandler.getSoTimeout()));
- assertEquals(Boolean.TRUE, new Boolean(protocolHandler.getTcpNoDelay()));
- assertEquals(InetAddress.getLocalHost(), protocolHandler.getAddress());
-
- if (connector != null)
- connector.stop();
- log.info(getName() + " PASSES");
- }
-
-
- protected String getTransport()
- {
- return "http";
- }
-
-
- protected void addExtraClientConfig(Map config) {}
- protected void addExtraServerConfig(Map config) {}
-
- static class TestInvocationHandler implements ServerInvocationHandler
- {
- public void addListener(InvokerCallbackHandler callbackHandler) {}
- public Object invoke(final InvocationRequest invocation) throws Throwable
- {
- return invocation.getParameter();
- }
- public void removeListener(InvokerCallbackHandler callbackHandler) {}
- public void setMBeanServer(MBeanServer server) {}
- public void setInvoker(ServerInvoker invoker) {}
- }
-
- static class TestObject
- {
- private int secret;
- public TestObject(int secret) {this.secret = secret;}
- public boolean equals(Object o)
- {
- if (!(o instanceof TestObject)) return false;
- return this.secret == ((TestObject) o).secret;
- }
- public String toString()
- {
- return "TestObject(" + secret + ")";
- }
- }
-}
\ No newline at end of file
Copied: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java (from rev 6315, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java)
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java (rev 0)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -0,0 +1,189 @@
+/*
+ * 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.coyote;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
+import junit.framework.TestCase;
+
+import org.apache.coyote.http11.Http11Protocol;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.coyote.CoyoteInvoker;
+
+
+/**
+ * Unit test for JBREM-1281
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Apr 13, 2011
+ */
+public class SetAttributeTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(SetAttributeTestCase.class);
+
+ private static boolean firstTime = 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 = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testSetExecutor() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "/?" + metadata;
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+
+ // Attributes set directly on Http11Protocol
+ config.put("maxSavePostSize", "3");
+ config.put("keepAlive", "false");
+ config.put("compression", "on");
+ config.put("testObject", new TestObject(5));
+
+ // Attributes set on Http11Protocol.endpoint
+ config.put("soTimeout", "7");
+ config.put("tcpNoDelay", "true");
+ config.put("address", InetAddress.getLocalHost());
+
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ CoyoteInvoker invoker = (CoyoteInvoker) connector.getServerInvoker();
+ Field field = CoyoteInvoker.class.getDeclaredField("protocolHandler");
+ field.setAccessible(true);
+ Http11Protocol protocolHandler = (Http11Protocol) field.get(invoker);
+ log.info("maxSavePostSize: " + protocolHandler.getMaxSavePostSize());
+ log.info("keepAlive: " + protocolHandler.getKeepAlive());
+ log.info("compression: " + protocolHandler.getCompression());
+ log.info("testObject: " + protocolHandler.getAttribute("testObject"));
+
+ log.info("soTimeout: " + protocolHandler.getSoTimeout());
+ log.info("tcpNoDelay: " + protocolHandler.getTcpNoDelay());
+ log.info("address: " + protocolHandler.getAddress());
+
+ assertEquals(new Integer(3), new Integer(protocolHandler.getMaxSavePostSize()));
+ assertEquals(Boolean.FALSE, new Boolean(protocolHandler.getKeepAlive()));
+ assertEquals("on", protocolHandler.getCompression());
+ assertEquals(new TestObject(5), protocolHandler.getAttribute("testObject"));
+
+ assertEquals(new Integer(7), new Integer(protocolHandler.getSoTimeout()));
+ assertEquals(Boolean.TRUE, new Boolean(protocolHandler.getTcpNoDelay()));
+ assertEquals(InetAddress.getLocalHost(), protocolHandler.getAddress());
+
+ if (connector != null)
+ connector.stop();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected String getTransport()
+ {
+ return "http";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+
+ static class TestObject
+ {
+ private int secret;
+ public TestObject(int secret) {this.secret = secret;}
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof TestObject)) return false;
+ return this.secret == ((TestObject) o).secret;
+ }
+ public String toString()
+ {
+ return "TestObject(" + secret + ")";
+ }
+ }
+}
\ No newline at end of file
Property changes on: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/ServletConfigurationMapTestClient.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/remoting-servlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/remoting-servlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/keystore
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/remoting-sslservlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/truststore
___________________________________________________________________
Deleted: svn:mergeinfo
-
Deleted: remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java 2011-03-19 20:51:35 UTC (rev 6284)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -1,228 +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.accept;
-
-import java.lang.reflect.Field;
-import java.net.InetAddress;
-import java.util.HashMap;
-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.SocketServerInvoker;
-
-
-/**
- * Unit tests for JBREM-1277
- *
- * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1 $
- * <p>
- * Copyright Mar 19, 2011
- */
-public class AcceptThreadPriorityTestCase extends TestCase
-{
- protected static String NUM_ACCEPT_THREADS = "3";
- protected static String PRIORITY_INCREMENT = "4";
-
- private static Logger log = Logger.getLogger(AcceptThreadPriorityTestCase.class);
-
- private static boolean firstTime = 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 = false;
- Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
- Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
- String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
- PatternLayout layout = new PatternLayout(pattern);
- ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- Logger.getRootLogger().addAppender(consoleAppender);
- }
- }
-
-
- public void tearDown()
- {
- }
-
-
- public void testAcceptThreadPriority() throws Throwable
- {
- log.info("entering " + getName());
-
- // Start server.
- setupServer(PRIORITY_INCREMENT);
-
- // Create client.
- InvokerLocator clientLocator = new InvokerLocator(locatorURI);
- HashMap clientConfig = new HashMap();
- clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraClientConfig(clientConfig);
- Client client = new Client(clientLocator, clientConfig);
- client.connect();
- log.info("client is connected");
-
- // Test connections.
- assertEquals("abc", client.invoke("abc"));
- log.info("connection is good");
-
- // Test accept threads priority.
- int defaultPriority = Thread.NORM_PRIORITY;
- int expectedPriority = defaultPriority + Integer.valueOf(PRIORITY_INCREMENT).intValue();
- Field field = SocketServerInvoker.class.getDeclaredField("acceptThreads");
- field.setAccessible(true);
- Thread[] acceptThreads = (Thread[]) field.get((SocketServerInvoker) connector.getServerInvoker());
- assertEquals(Integer.valueOf(NUM_ACCEPT_THREADS).intValue(), acceptThreads.length);
- for (int i = 0; i < acceptThreads.length; i++)
- {
- log.info("acceptThreads[" + i + "].getPriority(): " + acceptThreads[i].getPriority());
- assertEquals(expectedPriority, acceptThreads[i].getPriority());
-
- }
-
- client.disconnect();
- shutdownServer();
- log.info(getName() + " PASSES");
- }
-
- public void testAcceptThreadPriorityInvalidValue() throws Throwable
- {
- log.info("entering " + getName());
-
- // Discover invalid thread priority value.
- int invalidPriority = Thread.MAX_PRIORITY + 1;
-
- // Start server.
- setupServer(Integer.toString(invalidPriority));
-
- // Create client.
- InvokerLocator clientLocator = new InvokerLocator(locatorURI);
- HashMap clientConfig = new HashMap();
- clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraClientConfig(clientConfig);
- Client client = new Client(clientLocator, clientConfig);
- client.connect();
- log.info("client is connected");
-
- // Test connections.
- assertEquals("abc", client.invoke("abc"));
- log.info("connection is good");
-
- // Test accept threads priority.
- int defaultPriority = Thread.NORM_PRIORITY;
- Field field = SocketServerInvoker.class.getDeclaredField("acceptThreads");
- field.setAccessible(true);
- Thread[] acceptThreads = (Thread[]) field.get((SocketServerInvoker) connector.getServerInvoker());
- assertEquals(Integer.valueOf(NUM_ACCEPT_THREADS).intValue(), acceptThreads.length);
- for (int i = 0; i < acceptThreads.length; i++)
- {
- log.info("acceptThreads[" + i + "].getPriority(): " + acceptThreads[i].getPriority());
- assertEquals(defaultPriority, acceptThreads[i].getPriority());
-
- }
-
- client.disconnect();
- shutdownServer();
- log.info(getName() + " PASSES");
- }
-
- protected String getTransport()
- {
- return "socket";
- }
-
-
- protected void addExtraClientConfig(Map config) {}
- protected void addExtraServerConfig(Map config) {}
-
-
- protected void setupServer(String increment) throws Exception
- {
- host = InetAddress.getLocalHost().getHostAddress();
- port = PortUtil.findFreePort(host);
- locatorURI = getTransport() + "://" + host + ":" + port;
- locatorURI += "/?numAcceptThreads=" + NUM_ACCEPT_THREADS;
- locatorURI += "&acceptThreadPriorityIncrement=" + increment;
- String metadata = System.getProperty("remoting.metadata");
- if (metadata != null)
- {
- locatorURI += "&" + metadata;
- }
- serverLocator = new InvokerLocator(locatorURI);
- log.info("Starting remoting server with locator uri of: " + locatorURI);
- HashMap config = new HashMap();
- config.put(InvokerLocator.FORCE_REMOTE, "true");
- addExtraServerConfig(config);
- connector = new Connector(serverLocator, config);
- connector.create();
- invocationHandler = new TestInvocationHandler();
- connector.addInvocationHandler("test", invocationHandler);
- connector.start();
- }
-
-
- protected void shutdownServer() throws Exception
- {
- if (connector != null)
- connector.stop();
- }
-
-
- static class TestInvocationHandler implements ServerInvocationHandler
- {
- public void addListener(InvokerCallbackHandler callbackHandler) {}
- public Object invoke(final InvocationRequest invocation) throws Throwable
- {
- 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_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java (from rev 6284, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java)
===================================================================
--- remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java (rev 0)
+++ remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/src/tests/org/jboss/test/remoting/transport/socket/accept/AcceptThreadPriorityTestCase.java 2011-04-18 19:35:57 UTC (rev 6326)
@@ -0,0 +1,278 @@
+/*
+ * 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.accept;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+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;
+
+
+/**
+ * Unit tests for JBREM-1277
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Mar 19, 2011
+ */
+public class AcceptThreadPriorityTestCase extends TestCase
+{
+ protected static String NUM_ACCEPT_THREADS = "3";
+ protected static String PRIORITY_INCREMENT = "4";
+
+ private static Logger log = Logger.getLogger(AcceptThreadPriorityTestCase.class);
+
+ private static boolean firstTime = 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 = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testAcceptThreadPriority() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(PRIORITY_INCREMENT);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Test accept threads priority.
+ int defaultPriority = Thread.NORM_PRIORITY;
+ int expectedPriority = defaultPriority + Integer.valueOf(PRIORITY_INCREMENT).intValue();
+ Field field = SocketServerInvoker.class.getDeclaredField("acceptThreads");
+ field.setAccessible(true);
+ Thread[] acceptThreads = (Thread[]) field.get((SocketServerInvoker) connector.getServerInvoker());
+ assertEquals(Integer.valueOf(NUM_ACCEPT_THREADS).intValue(), acceptThreads.length);
+ for (int i = 0; i < acceptThreads.length; i++)
+ {
+ log.info("acceptThreads[" + i + "].getPriority(): " + acceptThreads[i].getPriority());
+ assertEquals(expectedPriority, acceptThreads[i].getPriority());
+
+ }
+
+ // Test worker threads priority.
+ field = SocketServerInvoker.class.getDeclaredField("clientpool");
+ field.setAccessible(true);
+ LRUPool clientpool = (LRUPool) field.get((SocketServerInvoker) connector.getServerInvoker());
+ Iterator it = clientpool.getContents().iterator();
+ while (it.hasNext())
+ {
+ Thread t = (Thread) it.next();
+ log.info(t + " priority: " + t.getPriority());
+ assertEquals(Thread.NORM_PRIORITY, t.getPriority());
+ }
+
+ field = SocketServerInvoker.class.getDeclaredField("threadpool");
+ field.setAccessible(true);
+ List threadpool = (List) field.get((SocketServerInvoker) connector.getServerInvoker());
+ it = threadpool.iterator();
+ while (it.hasNext())
+ {
+ Thread t = (Thread) it.next();
+ log.info(t + " priority: " + t.getPriority());
+ assertEquals(Thread.NORM_PRIORITY, t.getPriority());
+ }
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+ public void testAcceptThreadPriorityInvalidValue() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Discover invalid thread priority value.
+ int invalidPriority = Thread.MAX_PRIORITY + 1;
+
+ // Start server.
+ setupServer(Integer.toString(invalidPriority));
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Test accept threads priority.
+ int defaultPriority = Thread.NORM_PRIORITY;
+ Field field = SocketServerInvoker.class.getDeclaredField("acceptThreads");
+ field.setAccessible(true);
+ Thread[] acceptThreads = (Thread[]) field.get((SocketServerInvoker) connector.getServerInvoker());
+ assertEquals(Integer.valueOf(NUM_ACCEPT_THREADS).intValue(), acceptThreads.length);
+ for (int i = 0; i < acceptThreads.length; i++)
+ {
+ log.info("acceptThreads[" + i + "].getPriority(): " + acceptThreads[i].getPriority());
+ assertEquals(defaultPriority, acceptThreads[i].getPriority());
+
+ }
+
+ // Test worker threads priority.
+ field = SocketServerInvoker.class.getDeclaredField("clientpool");
+ field.setAccessible(true);
+ LRUPool clientpool = (LRUPool) field.get((SocketServerInvoker) connector.getServerInvoker());
+ Iterator it = clientpool.getContents().iterator();
+ while (it.hasNext())
+ {
+ Thread t = (Thread) it.next();
+ log.info(t + " priority: " + t.getPriority());
+ assertEquals(Thread.NORM_PRIORITY, t.getPriority());
+ }
+
+ field = SocketServerInvoker.class.getDeclaredField("threadpool");
+ field.setAccessible(true);
+ List threadpool = (List) field.get((SocketServerInvoker) connector.getServerInvoker());
+ it = threadpool.iterator();
+ while (it.hasNext())
+ {
+ Thread t = (Thread) it.next();
+ log.info(t + " priority: " + t.getPriority());
+ assertEquals(Thread.NORM_PRIORITY, t.getPriority());
+ }
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+ protected String getTransport()
+ {
+ return "socket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer(String increment) throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ locatorURI += "/?numAcceptThreads=" + NUM_ACCEPT_THREADS;
+ locatorURI += "&acceptThreadPriorityIncrement=" + increment;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "&" + metadata;
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraServerConfig(config);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+}
\ No newline at end of file
13 years, 7 months
JBoss Remoting SVN: r6325 - remoting2/branches.
by jboss-remoting-commits@lists.jboss.org
Author: jbertram(a)redhat.com
Date: 2011-04-18 14:28:48 -0400 (Mon, 18 Apr 2011)
New Revision: 6325
Added:
remoting2/branches/2.2.3_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1281/
Log:
JBPAPP-6351
13 years, 7 months
Newsletter Sun, 17 Apr 2011 11:02:13 +0300
by jboss-remoting-commits@lists.jboss.org
Hi!!
Do you want a good future, grow in money earning, and the admiration of all?
Special offer:
We can assist with Diplomas from prestigious universities based on your present knowledge and professional experience.
Get a Degree in 4 weeks with our program!
~Our program will let ALL with professional experience
get a 100% verified Degree:
~Doctorate
~Bachelors
~Masters
- Think about it...
- Just follow YOUR Dreams!
- Live a wonderful life by earning or upgrading your degree.
This is a splendid chance to make a right move and receive your due
benefits... if you are qualified but are lacking that piece of paper. Get one from us in a short time.
If you want to get better - you must Contact us 24 hours to start improving your life!
~CONTACT US~
1-305-460-2287
Please leave us a voice message with your name and phone number with country code if outside USA and we will call you asap.
It is your move...
Make the right decision.
Sincerely.
Do Not Reply to this Email.
We do not reply to text inquiries, and our server will reject all response traffic.
We apologize for any inconvenience this may have caused you.
13 years, 7 months
JBoss Remoting SVN: r6324 - remoting2/branches/2.2/src/main/org/jboss/remoting/transport/coyote.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2011-04-15 23:13:05 -0400 (Fri, 15 Apr 2011)
New Revision: 6324
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
Log:
JBREM-1281: Added logging of executor parameters.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2011-04-15 19:20:27 UTC (rev 6323)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2011-04-16 03:13:05 UTC (rev 6324)
@@ -1135,6 +1135,7 @@
static private void createAndSetExecutor(ProtocolHandler protocolHandler, String executorConfig)
{
Executor executor = new StandardThreadExecutor();
+ log.debug("setting executor to " + executor + " with properties:");
if (executorConfig != null)
{
String[] ss = executorConfig.split(",");
@@ -1142,6 +1143,7 @@
{
int pos = ss[i].indexOf('=');
setProperty(executor, ss[i].substring(0, pos).trim(), ss[i].substring(pos + 1).trim());
+ log.debug(ss[i].substring(0, pos).trim() + ": " + ss[i].substring(pos + 1).trim());
}
}
13 years, 7 months