JBoss Remoting SVN: r6340 - remoting2/branches/2.2/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2011-04-27 21:50:54 -0400 (Wed, 27 Apr 2011)
New Revision: 6340
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/Client.java
Log:
JBREM-1285: addListener() checks for LocalClientInvoker before deriving the transport from the InvokerLocator.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/Client.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/Client.java 2011-04-27 14:52:43 UTC (rev 6339)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/Client.java 2011-04-28 01:50:54 UTC (rev 6340)
@@ -1135,7 +1135,14 @@
}
if (transport == null)
{
- transport = invoker.getLocator().getProtocol();
+ if (invoker instanceof LocalClientInvoker)
+ {
+ transport = "local";
+ }
+ else
+ {
+ transport = invoker.getLocator().getProtocol();
+ }
metadata.put(CALLBACK_SERVER_PROTOCOL, transport);
}
if (host == null)
13 years, 7 months
JBoss Remoting SVN: r6339 - in remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281: docs/guide/en and 22 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: jbertram(a)redhat.com
Date: 2011-04-27 10:52:43 -0400 (Wed, 27 Apr 2011)
New Revision: 6339
Added:
remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/jbossweb/
remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/jbossweb/README
remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/jbossweb/jbossweb.jar
remoting2/branches/2.2.3-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/apache-tomcat/
remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/lib/jbossweb/jbossweb.jar
remoting2/branches/2.2.3-SP2_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-SP2_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-SP2_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-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/
remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/build.xml
remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/docs/guide/en/chap5.xml
remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
remoting2/branches/2.2.3-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/http/EmptyURITestCase.java
remoting2/branches/2.2.3-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/servlet/ssl/truststore
Log:
JBPAPP-6353
Property changes on: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/build.xml
===================================================================
--- remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/build.xml 2011-04-26 03:10:49 UTC (rev 6338)
+++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/build.xml 2011-04-27 14:52:43 UTC (rev 6339)
@@ -188,7 +188,7 @@
<!-- Compile -->
<!-- ================================================================== -->
<target name="compile" description="Compile all source files." depends="configure">
-
+ <echo>${java.runtime.version}</echo>
<mkdir dir="${compile.dir}"/>
<!-- java source compile -->
@@ -199,8 +199,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>
@@ -287,6 +298,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>
@@ -680,7 +698,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 -->
@@ -818,6 +838,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"/>
@@ -845,6 +866,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"/>
@@ -866,6 +893,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}"/>
@@ -1037,8 +1131,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 -->
@@ -1669,6 +1769,60 @@
</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"/>
Modified: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/docs/guide/en/chap5.xml
===================================================================
--- remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/docs/guide/en/chap5.xml 2011-04-26 03:10:49 UTC (rev 6338)
+++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/docs/guide/en/chap5.xml 2011-04-27 14:52:43 UTC (rev 6339)
@@ -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>
@@ -6812,6 +6834,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-SP2_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-SP2_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-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
--- remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2011-04-26 03:10:49 UTC (rev 6338)
+++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2011-04-27 14:52:43 UTC (rev 6339)
@@ -653,9 +653,6 @@
protected LeasePinger getLeasePinger()
{
- synchronized(clientLeaseLock)
- {
- return leasePinger;
- }
+ return leasePinger;
}
}
Modified: remoting2/branches/2.2.3-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java 2011-04-26 03:10:49 UTC (rev 6338)
+++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java 2011-04-27 14:52:43 UTC (rev 6339)
@@ -53,7 +53,7 @@
*/
public static final String PING_WINDOW_FACTOR = "pingWindowFactor";
public static final int PING_WINDOW_FACTOR_DEFAULT = 2;
-
+
/**
* Configuration key and default value for number of retries
* BisocketServerInvoker.ControlConnectionThread and
@@ -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-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java 2011-04-26 03:10:49 UTC (rev 6338)
+++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java 2011-04-27 14:52:43 UTC (rev 6339)
@@ -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");
+ }
+
if (isCallbackServer)
{
socketFactory = createSocketFactory(configuration);
@@ -861,6 +927,8 @@
{
private ServerSocket secondaryServerSocket;
boolean running = true;
+ Semaphore maxThreads = new Semaphore(dosMaxThreads);
+ int localDosTimeout = dosTimeout;
SecondaryServerSocketThread(ServerSocket secondaryServerSocket) throws IOException
{
@@ -881,41 +949,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.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);
- }
+ processSocket(socket);
}
catch (IOException e)
{
@@ -928,6 +962,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;
Modified: remoting2/branches/2.2.3-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2011-04-26 03:10:49 UTC (rev 6338)
+++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2011-04-27 14:52:43 UTC (rev 6339)
@@ -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
@@ -954,7 +961,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);
@@ -962,109 +969,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;
@@ -1089,4 +1131,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-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/ssl/RemotingSSLImplementation.java 2011-04-26 03:10:49 UTC (rev 6338)
+++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/coyote/ssl/RemotingSSLImplementation.java 2011-04-27 14:52:43 UTC (rev 6339)
@@ -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-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2011-04-26 03:10:49 UTC (rev 6338)
+++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2011-04-27 14:52:43 UTC (rev 6339)
@@ -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-SP2_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-SP2_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-SP2_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-SP2_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-27 14:52:43 UTC (rev 6339)
@@ -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-SP2_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-SP2_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-SP2_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-27 14:52:43 UTC (rev 6339)
@@ -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-SP2_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-SP2_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-27 14:52:43 UTC (rev 6339)
@@ -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-SP2_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-SP2_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-SP2_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-27 14:52:43 UTC (rev 6339)
@@ -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-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java 2011-04-27 14:52:43 UTC (rev 6339)
@@ -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-SP2_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-SP2_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-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java 2011-04-27 14:52:43 UTC (rev 6339)
@@ -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
Modified: remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/http/EmptyURITestCase.java
===================================================================
--- remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/http/EmptyURITestCase.java 2011-04-26 03:10:49 UTC (rev 6338)
+++ remoting2/branches/2.2.3-SP2_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281/src/tests/org/jboss/test/remoting/transport/http/EmptyURITestCase.java 2011-04-27 14:52:43 UTC (rev 6339)
@@ -1,222 +1,222 @@
-/*
- * 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.http;
-
-import java.io.IOException;
-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.CannotConnectException;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.InvokerRegistry;
-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.ServerFactory;
-import org.jboss.remoting.transport.coyote.CoyoteInvoker;
-import org.jboss.remoting.transport.http.TransportClientFactory;
-
-
-/**
- * Unit test for JBREM-1168.
- *
- * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1 $
- * <p>
- * Copyright Dec 13, 2009
- */
-public class EmptyURITestCase extends TestCase
-{
- private static Logger log = Logger.getLogger(EmptyURITestCase.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);
-
- InvokerRegistry.registerInvokerFactories("http", TransportClientFactory.class, TestCoyoteInvokerFactory.class);
- }
- }
-
-
- public void tearDown()
- {
- }
-
-
- public void testEmptyURI() throws Throwable
- {
- log.info("entering " + getName());
-
- // Start server.
- setupServer();
-
- // 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.
- try
- {
- Object response = client.invoke("abc");
- fail("expected CannotConnectException, got: " + response);
- }
- catch (CannotConnectException e)
- {
- String message = e.getMessage();
- assertTrue("expected CannotConnectException message to contain \"Invalid URI\"", message != null && message.indexOf("Invalid URI") > 0);
- log.info("got expected CannotConnectException");
- }
- catch (Throwable t)
- {
- fail("expected CannotConnectException, got: " + t);
- }
-
- client.disconnect();
- shutdownServer();
- log.info(getName() + " PASSES");
- }
-
-
- protected String getTransport()
- {
- return "http";
- }
-
-
- protected void addExtraClientConfig(Map config) {}
- protected void addExtraServerConfig(Map config) {}
-
-
- protected void setupServer() throws Exception
- {
- 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");
- 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) {}
- }
-
- static public class TestCoyoteInvokerFactory implements ServerFactory
- {
- public ServerInvoker createServerInvoker(InvokerLocator locator, Map config) throws IOException
- {
- return new TestCoyoteInvoker(locator, config);
- }
- public boolean supportsSSL()
- {
- return false;
- }
- }
-
-
- static class TestCoyoteInvoker extends CoyoteInvoker
- {
- public TestCoyoteInvoker(InvokerLocator locator)
- {
- super(locator);
- }
-
- public TestCoyoteInvoker(InvokerLocator locator, Map configuration)
- {
- super(locator, configuration);
- }
-
- public void service(org.apache.coyote.Request req, org.apache.coyote.Response res) throws Exception
- {
- byte[] b = new byte[]{};
- req.requestURI().setBytes(b, 0, 0);
- log.info(this + ".service()");
- super.service(req, res);
- }
- }
+/*
+ * 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.http;
+
+import java.io.IOException;
+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.CannotConnectException;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.InvokerRegistry;
+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.ServerFactory;
+import org.jboss.remoting.transport.coyote.CoyoteInvoker;
+import org.jboss.remoting.transport.http.TransportClientFactory;
+
+
+/**
+ * Unit test for JBREM-1168.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Dec 13, 2009
+ */
+public class EmptyURITestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(EmptyURITestCase.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);
+
+ InvokerRegistry.registerInvokerFactories("http", TransportClientFactory.class, TestCoyoteInvokerFactory.class);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testEmptyURI() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // 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.
+ try
+ {
+ Object response = client.invoke("abc");
+ fail("expected CannotConnectException, got: " + response);
+ }
+ catch (CannotConnectException e)
+ {
+ String message = e.getMessage();
+ assertTrue("expected CannotConnectException message to contain response code \"400\"", message != null && message.indexOf("400") > 0);
+ log.info("got expected CannotConnectException");
+ }
+ catch (Throwable t)
+ {
+ fail("expected CannotConnectException, got: " + t);
+ }
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected String getTransport()
+ {
+ return "http";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer() throws Exception
+ {
+ 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");
+ 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) {}
+ }
+
+ static public class TestCoyoteInvokerFactory implements ServerFactory
+ {
+ public ServerInvoker createServerInvoker(InvokerLocator locator, Map config) throws IOException
+ {
+ return new TestCoyoteInvoker(locator, config);
+ }
+ public boolean supportsSSL()
+ {
+ return false;
+ }
+ }
+
+
+ static class TestCoyoteInvoker extends CoyoteInvoker
+ {
+ public TestCoyoteInvoker(InvokerLocator locator)
+ {
+ super(locator);
+ }
+
+ public TestCoyoteInvoker(InvokerLocator locator, Map configuration)
+ {
+ super(locator, configuration);
+ }
+
+ public void service(org.apache.coyote.Request req, org.apache.coyote.Response res) throws Exception
+ {
+ byte[] b = new byte[]{};
+ req.requestURI().setBytes(b, 0, 0);
+ log.info(this + ".service()");
+ super.service(req, res);
+ }
+ }
}
\ No newline at end of file
Property changes on: remoting2/branches/2.2.3-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-SP2_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-27 14:52:43 UTC (rev 6339)
@@ -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-SP2_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-SP2_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-SP2_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-27 14:52:43 UTC (rev 6339)
@@ -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: r6338 - remoting2/branches/2.x/docs/guide/en.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2011-04-25 23:10:49 -0400 (Mon, 25 Apr 2011)
New Revision: 6338
Modified:
remoting2/branches/2.x/docs/guide/en/chap5.xml
Log:
JBREM-1283: Added discussion of configuring an executor in CoyoteInvoker.
Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml
===================================================================
--- remoting2/branches/2.x/docs/guide/en/chap5.xml 2011-04-25 23:47:54 UTC (rev 6337)
+++ remoting2/branches/2.x/docs/guide/en/chap5.xml 2011-04-26 03:10:49 UTC (rev 6338)
@@ -1815,30 +1815,44 @@
<para>The HTTP server invoker implementation is based on the Coyote
HTTP/1.1 Connector Tomcat component, which is supplied by the JBossWeb
- implementation, in jbossweb.jar.</para>
+ implementation in jbossweb.jar.</para>
<para><emphasis role="bold">Note.</emphasis> Prior to release 2.5.0.GA,
Remoting also was compatible with the Apache implementation of
- Tomcat, which is no longer the case. Since JBossWeb requires jdk 1.5 or above, it follows that the HTTP transport in Remoting 2.5.0.GA and above has the same requirement.</para>
+ Tomcat, which is no longer the case. Since JBossWeb requires jdk 1.5 or above,
+ it follows that the HTTP transport in Remoting 2.5.0.GA and above has the same requirement.</para>
<para>The coyote Connector supports GET, POST, HEAD, OPTIONS, and HEAD
method types and keep-alive, and most any configuration allowed for Tomcat
can be configured for the remoting HTTP server invoker. For more
information on the configuration attributes available for the Tomcat
connectors, please refer to <ulink
- url="http://tomcat.apache.org/tomcat-5.5-doc/config/http.html">http://tomcat.apache.org/tomcat-5.5-doc/config/http.html</ulink>.
- http://tomcat.apache.org/tomcat-5.5-doc/config/http.html <!--<link
- linkend="???">http://tomcat.apache.org/tomcat-5.5-doc/config/http.html</link>-->
- So for example, if wanted to set the maximum number of threads to be used
- to accept incoming http requests, would use the 'maxThreads' attribute.
- The only exception when should use remoting configuration over the Tomcat
- configuration is for attribute 'address' (use serverBindAddress instead)
- and attribute 'port' (use serverBindPort instead).</para>
+ url="http://tomcat.apache.org/tomcat-6.0-doc/config/http.html">http://tomcat.apache.org/tomcat-6.0-doc/config/http.html</ulink>.
+ The Tomcat parameters passed into the http server invoker are passed on
+ to Tomcat. For example, the Tomcat attribute "maxThreads" can be used to set the
+ maximum number of threads to be used to accept incoming http requests.
+ The only exceptions are the Remoting attributes "serverBindAddress" and
+ "serverBindPort", which should be used instead of the Tomcat attributes
+ "address" and "port".</para>
- <para>Note: The http invoker no longer has the configuration attributes
- 'maxNumThreadsHTTP' or 'HTTPThreadPool' as thread pooling is now handled
- within the Tomcat connectors, which does not expose external API for
- setting these.</para>
+ <para><emphasis role="bold">Note.</emphasis> An executor, subclassed from
+ <classname>java.util.concurrent.Executor</classname>, can be configured and
+ injected into the coyote Connector. As of release 2.5.4.SP2, Remoting can configure
+ and inject an instance of <classname>org.apache.catalina.core.StandardThreadExecutor</classname>.
+ The configurable attributes of the <classname>StandardThreadExecutor</classname>
+ are described in <ulink
+ url="http://tomcat.apache.org/tomcat-6.0-doc/config/executor.html">http://tomcat.apache.org/tomcat-6.0-doc/config/executor.html</ulink>.
+ These attributes may be passed to Remoting using the key "executor" and a string of
+ the form "attribute0=value0,...,attributeN=valueN". For example, a <code>*-service.xml</code> configuration file
+ could contain</para>
+
+ <programlisting><attribute name="executor">minSpareThreads=20,maxThreads=100</attribute></programlisting>
+
+ <para>Remoting will parse the comma separated list, ignoring white space, create and configure
+ a <classname>StandardThreadExecutor</classname>, and inject it into the coyote Connector. Note that
+ if an executor is injected, the other threadpool related attributes such as "maxThreads", which would otherwise
+ be applied to a threadpool created by the coyote Connector, are ignored.
+ </para>
<para>A feature introduced in Remoting version 2.4 is the ability to
configure <classname>HTTPClientInvoker</classname> to make multiple
@@ -1856,10 +1870,10 @@
possible to switch to use the
<code>org.apache.coyote.http11.Http11AprProtocol</code> protocol, which is
based on the Apache Portable Runtime (see <ulink
- url="http://www.jboss.org/file-access/default/members/jbossweb/freezone/docs/2...">
- http://www.jboss.org/file-access/default/members/jbossweb/freezone/docs/2...</ulink>
- for more details). If want to use the APR implementation, simply put the
- tcnative-1.dll (or tcnative-1.so) on the system path so can be loaded. The
+ url="http://tomcat.apache.org/tomcat-6.0-doc/apr.html">
+ http://tomcat.apache.org/tomcat-6.0-doc/apr.html</ulink>
+ for more details). To use the APR implementation, simply put the
+ tcnative-1.dll (or tcnative-1.so) on the system path so it can be loaded. The
JBossWeb native libraries, which include tcnative-1.dll/tcnative-1.so, may
be downloaded from <ulink
url="http://www.jboss.org/jbossweb/">http://www.jboss.org/jbossweb/</ulink>.</para>
@@ -6580,6 +6594,19 @@
</section>
<section>
+ <title>org.jboss.remoting.transport.coyote.CoyoteInvoker</title>
+
+ <para> <emphasis role="bold">"executor"</emphasis>: a comma separated list of attributes
+ associated with this key will be used to configure an
+ <classname>org.apache.catalina.core.StandardThreadExecutor</classname>, which
+ will then be injected into the underlying Coyote Connector. See
+ <ulink
+ url="http://tomcat.apache.org/tomcat-6.0-doc/config/executor.html">http://tomcat.apache.org/tomcat-6.0-doc/config/executor.html</ulink>.
+ for the available configurable attributes.
+ </para>
+ </section>
+
+ <section>
<title>org.jboss.remoting.transport.http.HTTPClientInvoker</title>
<para> <emphasis role="bold">NUMBER_OF_CALL_ATTEMPTS</emphasis> (actual
13 years, 7 months
JBoss Remoting SVN: r6337 - remoting2/branches/2.x.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2011-04-25 19:47:54 -0400 (Mon, 25 Apr 2011)
New Revision: 6337
Modified:
remoting2/branches/2.x/build.xml
Log:
JBREM-1283:Excluded some tests in tests.compile if using jdk 1.4.
Modified: remoting2/branches/2.x/build.xml
===================================================================
--- remoting2/branches/2.x/build.xml 2011-04-25 18:35:07 UTC (rev 6336)
+++ remoting2/branches/2.x/build.xml 2011-04-25 23:47:54 UTC (rev 6337)
@@ -526,9 +526,13 @@
sourcepath="">
<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"/>
+ <exclude name="org/jboss/test/remoting/tests/**" if="isJDK4"/>
<exclude name="org/jboss/test/remoting/lease/LeaseCreationTimeoutJDK14TestCase*" unless="isJDK4"/>
<exclude name="org/jboss/test/remoting/lease/LeaseCreationTimeoutTestCase*" if="isJDK4"/>
<classpath refid="tests.classpath"/>
13 years, 7 months
Newsletter Mon, 25 Apr 2011 13:39:37 -0500
by jboss-remoting-commits@lists.jboss.org
Hello!
Do you want a good future, grow in money earning, and pat on the back :)?
Today only:
We can assist with Diplomas from prestigious universities based on your present knowledge and professional experience.
Get a Degree in 6 weeks with our program!
~Our program will let EVERYONE with professional experience
gain a 100% verified Degree:
~Doctorate
~Bachelors
~Masters
- Think about it...
- Follow YOUR Dreams!
- Live a much better life by earning or upgrading your degree.
This is a exellent way 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 fraction of the time.
If you want to get better - you must Contact Today to start improving your life!
~CALL~
1-916-484-3795
You must leave us a message with your phone number with country code if outside USA and name and we will get back to you asap.
It is your chance...
Make the right move.
Yours 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: r6336 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport: coyote and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2011-04-25 14:35:07 -0400 (Mon, 25 Apr 2011)
New Revision: 6336
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/coyote/
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java
Log:
JBREM-1283: New unit test.
Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java 2011-04-25 18:35:07 UTC (rev 6336)
@@ -0,0 +1,214 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.test.remoting.transport.coyote;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
+import junit.framework.TestCase;
+
+import org.apache.catalina.core.StandardThreadExecutor;
+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.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-1283
+ *
+ * @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(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 testSetProperties() 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());
+
+ // Executor
+ String s = "daemon=false,maxIdleTime=11, minSpareThreads =13,maxThreads = 17 ,";
+ s += " name= test ,namePrefix=prefix,threadPriority=" + (Thread.NORM_PRIORITY + 1);
+ s += ", bogus=fake";
+ config.put("executor", s);
+
+ 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("protocolHandlers");
+ field.setAccessible(true);
+ List protocolHandlers = (List) field.get(invoker);
+ Http11Protocol protocolHandler = (Http11Protocol) protocolHandlers.iterator().next();
+ 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());
+
+ StandardThreadExecutor executor = (StandardThreadExecutor) protocolHandler.getExecutor();
+ log.info("daemon: " + executor.isDaemon());
+ log.info("maxIdleTime: " + executor.getMaxIdleTime());
+ log.info("minSpareThreads: " + executor.getMinSpareThreads());
+ log.info("maxThreads: " + executor.getMaxThreads());
+ log.info("name: " + executor.getName());
+ log.info("namePrefix: " + executor.getNamePrefix());
+ log.info("threadPriority: " + executor.getThreadPriority());
+
+ assertFalse(executor.isDaemon());
+ assertEquals(11, executor.getMaxIdleTime());
+ assertEquals(13, executor.getMinSpareThreads());
+ assertEquals(17, executor.getMaxThreads());
+ assertEquals("test", executor.getName());
+ assertEquals("prefix", executor.getNamePrefix());
+ assertEquals(Thread.NORM_PRIORITY + 1, executor.getThreadPriority());
+
+ 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.x/src/tests/org/jboss/test/remoting/transport/coyote/SetAttributeTestCase.java
___________________________________________________________________
Added: svn:executable
+ *
13 years, 7 months
JBoss Remoting SVN: r6335 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2011-04-25 14:34:07 -0400 (Mon, 25 Apr 2011)
New Revision: 6335
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
Log:
JBREM-1283: Added special handling for setting the tomcat executor.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2011-04-25 15:34:52 UTC (rev 6334)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2011-04-25 18:34:07 UTC (rev 6335)
@@ -17,6 +17,9 @@
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;
@@ -187,18 +190,19 @@
}
protocolHandler.setAdapter(this);
- // Pass all attributes to the protocol handler
- Iterator keys = config.keySet().iterator();
- while(keys.hasNext())
+ // Pass all attributes to the protocol handler
+ Iterator keys = config.keySet().iterator();
+ while(keys.hasNext())
+ {
+ String key = (String) keys.next();
+ Object obj = config.get(key);
+ if ("executor".equals(key) && obj instanceof String)
{
- String key = (String) keys.next();
- Object obj = config.get(key);
- if (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
String timeoutValue = (String)config.get(TIMEOUT);
@@ -1051,7 +1055,7 @@
* int or boolean we'll convert value to the right type before) - that means
* you can have setDebug(1).
*/
- public static boolean setProperty(final Object o, String name, final String value)
+ public static boolean setProperty(final Object o, String name, final Object value)
{
String setter = "set" + capitalize(name);
@@ -1075,108 +1079,144 @@
}
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] = getAddressByName(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;
@@ -1211,6 +1251,34 @@
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);
+ }
+
static private Object forName(final String className) throws ClassNotFoundException
{
if (SecurityUtility.skipAccessControl())
13 years, 7 months
JBoss Remoting SVN: r6334 - in 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 and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: jbertram(a)redhat.com
Date: 2011-04-25 11:34:52 -0400 (Mon, 25 Apr 2011)
New Revision: 6334
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/
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/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
Log:
JBPAPP-6352
Property changes on: 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
___________________________________________________________________
Added: svn:mergeinfo
+ /remoting2/branches/2.2/src/main/org/jboss/remoting/transport/bisocket:6272-6273
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-25 14:48:31 UTC (rev 6333)
+++ 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-25 15:34:52 UTC (rev 6334)
@@ -78,11 +78,11 @@
public static final String SECONDARY_CONNECT_PORT = "secondaryConnectPort";
/**
- * Configuration keys and default valuesfor parameters related to DOS attack
+ * Configuration keys and default values for parameters related to DOS attack
* on BisocketServerInvoker.SecondaryServerSocketThread
*/
- public static final String DOS_MAX_THREADS = "dosMaxThreads";
- public static final String DOS_TIMEOUT = "dosTimeout";
- public static final int DOS_MAX_THREADS_DEFAULT = 50;
- public static final int DOS_TIMEOUT_DEFAULT = 60;
+ 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-25 14:48:31 UTC (rev 6333)
+++ 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-25 15:34:52 UTC (rev 6334)
@@ -87,8 +87,8 @@
protected boolean isCallbackServer = false;
protected int secondaryBindPort = -1;
protected int secondaryConnectPort = -1;
- protected int dosMaxThreads = Bisocket.DOS_MAX_THREADS_DEFAULT;
- protected int dosTimeout = Bisocket.DOS_TIMEOUT_DEFAULT;
+ protected int dosMaxThreads = Bisocket.SECONDARY_MAX_THREADS_DEFAULT;
+ protected int dosTimeout = Bisocket.SECONDARY_TIMEOUT_DEFAULT;
public static BisocketServerInvoker getBisocketServerInvoker(String listenerId)
@@ -539,7 +539,7 @@
log.warn("\"" + Bisocket.SECONDARY_CONNECT_PORT + "\" must be specified as a String");
}
- o = configuration.get(Bisocket.DOS_MAX_THREADS);
+ o = configuration.get(Bisocket.SECONDARY_MAX_THREADS);
if (o instanceof String && ((String) o).length() > 0)
{
try
@@ -549,15 +549,15 @@
}
catch (NumberFormatException e)
{
- log.warn("Invalid format for " + "\"" + Bisocket.DOS_MAX_THREADS + "\": " + o);
+ log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_MAX_THREADS + "\": " + o);
}
}
else if (o != null)
{
- log.warn("\"" + Bisocket.DOS_MAX_THREADS + "\" must be specified as a String");
+ log.warn("\"" + Bisocket.SECONDARY_MAX_THREADS + "\" must be specified as a String");
}
- o = configuration.get(Bisocket.DOS_TIMEOUT);
+ o = configuration.get(Bisocket.SECONDARY_TIMEOUT);
if (o instanceof String && ((String) o).length() > 0)
{
try
@@ -567,12 +567,12 @@
}
catch (NumberFormatException e)
{
- log.warn("Invalid format for " + "\"" + Bisocket.DOS_TIMEOUT + "\": " + o);
+ log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_TIMEOUT + "\": " + o);
}
}
else if (o != null)
{
- log.warn("\"" + Bisocket.DOS_TIMEOUT + "\" must be specified as a String");
+ log.warn("\"" + Bisocket.SECONDARY_TIMEOUT + "\" must be specified as a String");
}
if (isCallbackServer)
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/bisocket/dos
___________________________________________________________________
Added: svn:mergeinfo
+ /remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/dos:6271
Modified: 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/bisocket/dos/DosTestCase.java 2011-04-25 14:48:31 UTC (rev 6333)
+++ 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-25 15:34:52 UTC (rev 6334)
@@ -215,7 +215,7 @@
public void testConfigurationDefault() throws Throwable
{
log.info("entering " + getName());
- doConfigurationTest(false, false, Integer.valueOf(Bisocket.DOS_MAX_THREADS_DEFAULT).intValue(), Integer.valueOf(Bisocket.DOS_TIMEOUT_DEFAULT).intValue());
+ doConfigurationTest(false, false, Bisocket.SECONDARY_MAX_THREADS_DEFAULT, Bisocket.SECONDARY_TIMEOUT_DEFAULT);
log.info(getName() + " PASSES");
}
@@ -325,13 +325,13 @@
{
if (useInvokerLocator)
{
- locatorURI += "&" + Bisocket.DOS_MAX_THREADS + "=" + Integer.toString(dosMaxThreadsValue);
- locatorURI += "&" + Bisocket.DOS_TIMEOUT + "=" + Integer.toString(dosTimeoutValue);
+ locatorURI += "&" + Bisocket.SECONDARY_MAX_THREADS + "=" + Integer.toString(dosMaxThreadsValue);
+ locatorURI += "&" + Bisocket.SECONDARY_TIMEOUT + "=" + Integer.toString(dosTimeoutValue);
}
else
{
- config.put(Bisocket.DOS_MAX_THREADS, Integer.toString(dosMaxThreadsValue));
- config.put(Bisocket.DOS_TIMEOUT, Integer.toString(dosTimeoutValue));
+ config.put(Bisocket.SECONDARY_MAX_THREADS, Integer.toString(dosMaxThreadsValue));
+ config.put(Bisocket.SECONDARY_TIMEOUT, Integer.toString(dosTimeoutValue));
}
}
serverLocator = new InvokerLocator(locatorURI);
13 years, 7 months
Newsletter Mon, 25 Apr 2011 16:10:10 +0100
by jboss-remoting-commits@lists.jboss.org
Dear Lady or Gentleman!
Do you want a good future, double in money earning, and pat on the back :)?
Today only:
We can assist with Diplomas from prestigious universities based on your present knowledge and work experience.
Get a Degree in 4 weeks with our program!
~Our program will help ANYONE with professional experience
get a 100% verified Degree:
~Doctorate
~Bachelors
~Masters
- Just think about it...
- You can realize YOUR Dreams!
- Live a wonderful life by earning or upgrading your degree.
This is a good way 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.
Contact us NOW to start improving your life!
~CONTACT US~
1-305-460-2287
Please leave us a message with your name and phone number with country code if outside USA and we will contact you as soon as possible.
It is your chance...
Make the right decision.
Best wishes.
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: r6333 - in 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 and 1 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: jbertram(a)redhat.com
Date: 2011-04-25 10:48:31 -0400 (Mon, 25 Apr 2011)
New Revision: 6333
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/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/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java
Log:
JBPAPP-6352
Property changes on: remoting2/branches/2.2.3-SP1_JBREM-1269_JBREM-1275_JBREM-1261_JBREM-1277_JBREM-1280_JBREM-1281
___________________________________________________________________
Modified: svn:mergeinfo
- /remoting2/branches/2.2:6177-6178,6226,6253,6266-6267,6271-6273,6281-6284,6291-6292,6297,6313-6320,6322-6324
+ /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-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-19 03:12:07 UTC (rev 6332)
+++ 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-25 14:48:31 UTC (rev 6333)
@@ -53,7 +53,7 @@
*/
public static final String PING_WINDOW_FACTOR = "pingWindowFactor";
public static final int PING_WINDOW_FACTOR_DEFAULT = 2;
-
+
/**
* Configuration key and default value for number of retries
* BisocketServerInvoker.ControlConnectionThread and
@@ -78,11 +78,11 @@
public static final String SECONDARY_CONNECT_PORT = "secondaryConnectPort";
/**
- * Configuration keys and default values for parameters related to DOS attack
+ * Configuration keys and default valuesfor 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;
+ public static final String DOS_MAX_THREADS = "dosMaxThreads";
+ public static final String DOS_TIMEOUT = "dosTimeout";
+ public static final int DOS_MAX_THREADS_DEFAULT = 50;
+ public static final int DOS_TIMEOUT_DEFAULT = 60;
}
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-19 03:12:07 UTC (rev 6332)
+++ 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-25 14:48:31 UTC (rev 6333)
@@ -87,8 +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;
+ protected int dosMaxThreads = Bisocket.DOS_MAX_THREADS_DEFAULT;
+ protected int dosTimeout = Bisocket.DOS_TIMEOUT_DEFAULT;
public static BisocketServerInvoker getBisocketServerInvoker(String listenerId)
@@ -364,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;
@@ -515,7 +539,7 @@
log.warn("\"" + Bisocket.SECONDARY_CONNECT_PORT + "\" must be specified as a String");
}
- o = configuration.get(Bisocket.SECONDARY_MAX_THREADS);
+ o = configuration.get(Bisocket.DOS_MAX_THREADS);
if (o instanceof String && ((String) o).length() > 0)
{
try
@@ -525,15 +549,15 @@
}
catch (NumberFormatException e)
{
- log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_MAX_THREADS + "\": " + o);
+ log.warn("Invalid format for " + "\"" + Bisocket.DOS_MAX_THREADS + "\": " + o);
}
}
else if (o != null)
{
- log.warn("\"" + Bisocket.SECONDARY_MAX_THREADS + "\" must be specified as a String");
+ log.warn("\"" + Bisocket.DOS_MAX_THREADS + "\" must be specified as a String");
}
- o = configuration.get(Bisocket.SECONDARY_TIMEOUT);
+ o = configuration.get(Bisocket.DOS_TIMEOUT);
if (o instanceof String && ((String) o).length() > 0)
{
try
@@ -543,12 +567,12 @@
}
catch (NumberFormatException e)
{
- log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_TIMEOUT + "\": " + o);
+ log.warn("Invalid format for " + "\"" + Bisocket.DOS_TIMEOUT + "\": " + o);
}
}
else if (o != null)
{
- log.warn("\"" + Bisocket.SECONDARY_TIMEOUT + "\" must be specified as a String");
+ log.warn("\"" + Bisocket.DOS_TIMEOUT + "\" must be specified as a String");
}
if (isCallbackServer)
@@ -903,7 +927,8 @@
{
private ServerSocket secondaryServerSocket;
boolean running = true;
- Semaphore maxThreads = new Semaphore(maxPoolSize);
+ Semaphore maxThreads = new Semaphore(dosMaxThreads);
+ int localDosTimeout = dosTimeout;
SecondaryServerSocketThread(ServerSocket secondaryServerSocket) throws IOException
{
@@ -960,7 +985,7 @@
if (log.isTraceEnabled()) log.trace(this + " processing socket: " + socket);
try
{
- socket.setSoTimeout(DEFAULT_TIMEOUT_PERIOD);
+ socket.setSoTimeout(localDosTimeout);
DataInputStream dis = new DataInputStream(socket.getInputStream());
int action = dis.read();
String listenerId = dis.readUTF();
Modified: 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/bisocket/dos/DosTestCase.java 2011-04-19 03:12:07 UTC (rev 6332)
+++ 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-25 14:48:31 UTC (rev 6333)
@@ -22,6 +22,7 @@
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;
@@ -49,7 +50,10 @@
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$
@@ -61,6 +65,8 @@
{
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;
@@ -100,7 +106,7 @@
log.info("entering " + getName());
// Start server.
- setupServer();
+ setupServer(false, false);
// Create client.
HashMap clientConfig = new HashMap();
@@ -209,7 +215,7 @@
public void testConfigurationDefault() throws Throwable
{
log.info("entering " + getName());
- doConfigurationTest(false, false, Bisocket.SECONDARY_MAX_THREADS_DEFAULT, Bisocket.SECONDARY_TIMEOUT_DEFAULT);
+ doConfigurationTest(false, false, Integer.valueOf(Bisocket.DOS_MAX_THREADS_DEFAULT).intValue(), Integer.valueOf(Bisocket.DOS_TIMEOUT_DEFAULT).intValue());
log.info(getName() + " PASSES");
}
@@ -301,7 +307,7 @@
protected void addExtraServerConfig(Map config) {}
- protected void setupServer() throws Exception
+ protected void setupServer(boolean setParameters, boolean useInvokerLocator) throws Exception
{
host = InetAddress.getLocalHost().getHostAddress();
port = PortUtil.findFreePort(host);
@@ -312,8 +318,6 @@
{
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);
@@ -321,13 +325,13 @@
{
if (useInvokerLocator)
{
- locatorURI += "&" + Bisocket.SECONDARY_MAX_THREADS + "=" + Integer.toString(dosMaxThreadsValue);
- locatorURI += "&" + Bisocket.SECONDARY_TIMEOUT + "=" + Integer.toString(dosTimeoutValue);
+ locatorURI += "&" + Bisocket.DOS_MAX_THREADS + "=" + Integer.toString(dosMaxThreadsValue);
+ locatorURI += "&" + Bisocket.DOS_TIMEOUT + "=" + Integer.toString(dosTimeoutValue);
}
else
{
- config.put(Bisocket.SECONDARY_MAX_THREADS, Integer.toString(dosMaxThreadsValue));
- config.put(Bisocket.SECONDARY_TIMEOUT, Integer.toString(dosTimeoutValue));
+ config.put(Bisocket.DOS_MAX_THREADS, Integer.toString(dosMaxThreadsValue));
+ config.put(Bisocket.DOS_TIMEOUT, Integer.toString(dosTimeoutValue));
}
}
serverLocator = new InvokerLocator(locatorURI);
13 years, 7 months