Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

requested ported commit

  • Loading branch information...
commit fc06d73895b4920eb31527fcd8f1a72619ebf74c 0 parents
@jfclere jfclere authored
Showing with 29,112 additions and 0 deletions.
  1. +9 −0 .classpath
  2. +23 −0 .project
  3. +104 −0 JBossORG-EULA.txt
  4. +33 −0 README.txt
  5. +91 −0 build-demo.xml
  6. +51 −0 build-jbossweb.xml
  7. +443 −0 build-test.xml
  8. +10 −0 docs/README
  9. +165 −0 lgpl.txt
  10. +84 −0 local.properties
  11. 0  native/advertise/.deps
  12. +23 −0 native/advertise/Makefile.in
  13. +17 −0 native/advertise/README
  14. +12 −0 native/advertise/buildconf
  15. +24 −0 native/advertise/configure.in
  16. +702 −0 native/advertise/mod_advertise.c
  17. +146 −0 native/advertise/mod_advertise.h
  18. +154 −0 native/include/balancer.h
  19. +156 −0 native/include/context.h
  20. +149 −0 native/include/host.h
  21. +51 −0 native/include/mod_clustersize.h
  22. +48 −0 native/include/mod_proxy_cluster.h
  23. +217 −0 native/include/node.h
  24. +156 −0 native/include/sessionid.h
  25. +163 −0 native/include/slotmem.h
  26. 0  native/mod_manager/.deps
  27. +23 −0 native/mod_manager/Makefile.in
  28. +228 −0 native/mod_manager/balancer.c
  29. +12 −0 native/mod_manager/buildconf
  30. +24 −0 native/mod_manager/configure.in
  31. +229 −0 native/mod_manager/context.c
  32. +226 −0 native/mod_manager/host.c
  33. +1,941 −0 native/mod_manager/mod_manager.c
  34. +281 −0 native/mod_manager/node.c
  35. +226 −0 native/mod_manager/sessionid.c
  36. 0  native/mod_proxy_cluster/.deps
  37. +34 −0 native/mod_proxy_cluster/Makefile.in
  38. +11 −0 native/mod_proxy_cluster/buildconf
  39. +28 −0 native/mod_proxy_cluster/config.m4.patch
  40. +24 −0 native/mod_proxy_cluster/configure.in
  41. +49 −0 native/mod_proxy_cluster/mod_proxy_ajp.patch
  42. +2,066 −0 native/mod_proxy_cluster/mod_proxy_cluster.c
  43. 0  native/mod_slotmem/.deps
  44. +23 −0 native/mod_slotmem/Makefile.in
  45. +12 −0 native/mod_slotmem/buildconf
  46. +24 −0 native/mod_slotmem/configure.in
  47. +108 −0 native/mod_slotmem/mod_sharedmem.c
  48. +549 −0 native/mod_slotmem/sharedmem_util.c
  49. +20 −0 native/mod_slotmem/sharedmem_util.h
  50. +406 −0 pom.xml
  51. +30 −0 src/assembly/bin.xml
  52. +18 −0 src/assembly/sar.xml
  53. +31 −0 src/demo/java/org/jboss/modcluster/demo/Constants.java
  54. +146 −0 src/demo/java/org/jboss/modcluster/demo/client/ChartManager.java
  55. +1,013 −0 src/demo/java/org/jboss/modcluster/demo/client/ModClusterDemo.java
  56. +436 −0 src/demo/java/org/jboss/modcluster/demo/client/RequestDriver.java
  57. +69 −0 src/demo/java/org/jboss/modcluster/demo/client/load/ServerLoadParam.java
  58. +148 −0 src/demo/java/org/jboss/modcluster/demo/client/load/ServerLoadServlets.java
  59. +70 −0 src/demo/java/org/jboss/modcluster/demo/servlet/ActiveSessionsLoadServlet.java
  60. +112 −0 src/demo/java/org/jboss/modcluster/demo/servlet/BusyConnectorsLoadServlet.java
  61. +108 −0 src/demo/java/org/jboss/modcluster/demo/servlet/ConnectionPoolLoadServlet.java
  62. +78 −0 src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java
  63. +137 −0 src/demo/java/org/jboss/modcluster/demo/servlet/LoadServlet.java
  64. +83 −0 src/demo/java/org/jboss/modcluster/demo/servlet/ReceiveTrafficLoadServlet.java
  65. +98 −0 src/demo/java/org/jboss/modcluster/demo/servlet/RecordServlet.java
  66. +57 −0 src/demo/java/org/jboss/modcluster/demo/servlet/RequestCountLoadServlet.java
  67. +95 −0 src/demo/java/org/jboss/modcluster/demo/servlet/SendTrafficLoadServlet.java
  68. +67 −0 src/demo/java/org/jboss/modcluster/demo/servlet/SystemLoadServlet.java
  69. +72 −0 src/demo/java/org/jboss/modcluster/demo/servlet/ThreadCountLoadServlet.java
  70. +12 −0 src/demo/resources/run-demo.bat
  71. +16 −0 src/demo/resources/run-demo.sh
  72. +144 −0 src/demo/resources/web.xml
  73. +181 −0 src/main/java/org/jboss/modcluster/AbstractModClusterService.java
  74. +360 −0 src/main/java/org/jboss/modcluster/CatalinaEventHandler.java
  75. +203 −0 src/main/java/org/jboss/modcluster/CatalinaEventHandlerAdapter.java
  76. +27 −0 src/main/java/org/jboss/modcluster/Constants.java
  77. +48 −0 src/main/java/org/jboss/modcluster/ContainerEventHandler.java
  78. +40 −0 src/main/java/org/jboss/modcluster/LocalStrings.properties
  79. +232 −0 src/main/java/org/jboss/modcluster/ModClusterListener.java
  80. +60 −0 src/main/java/org/jboss/modcluster/ModClusterService.java
  81. +96 −0 src/main/java/org/jboss/modcluster/ModClusterServiceMBean.java
  82. +31 −0 src/main/java/org/jboss/modcluster/ServerProvider.java
  83. +333 −0 src/main/java/org/jboss/modcluster/Utils.java
  84. +58 −0 src/main/java/org/jboss/modcluster/advertise/AdvertiseListener.java
  85. +34 −0 src/main/java/org/jboss/modcluster/advertise/AdvertiseListenerFactory.java
  86. +36 −0 src/main/java/org/jboss/modcluster/advertise/MulticastSocketFactory.java
  87. +63 −0 src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseEventType.java
  88. +43 −0 src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerFactoryImpl.java
  89. +549 −0 src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java
  90. +123 −0 src/main/java/org/jboss/modcluster/advertise/impl/AdvertisedServer.java
  91. +115 −0 src/main/java/org/jboss/modcluster/advertise/impl/MulticastSocketFactoryImpl.java
  92. +55 −0 src/main/java/org/jboss/modcluster/config/BalancerConfiguration.java
  93. +55 −0 src/main/java/org/jboss/modcluster/config/LoadConfiguration.java
  94. +75 −0 src/main/java/org/jboss/modcluster/config/MCMPHandlerConfiguration.java
  95. +192 −0 src/main/java/org/jboss/modcluster/config/ModClusterConfig.java
  96. +67 −0 src/main/java/org/jboss/modcluster/config/NodeConfiguration.java
  97. +108 −0 src/main/java/org/jboss/modcluster/config/SSLConfiguration.java
  98. +34 −0 src/main/java/org/jboss/modcluster/config/ha/HAConfiguration.java
  99. +35 −0 src/main/java/org/jboss/modcluster/config/ha/HAModClusterConfig.java
  100. +52 −0 src/main/java/org/jboss/modcluster/ha/ClusteredMCMPHandler.java
  101. +582 −0 src/main/java/org/jboss/modcluster/ha/ClusteredMCMPHandlerImpl.java
  102. +972 −0 src/main/java/org/jboss/modcluster/ha/HAModClusterService.java
  103. +38 −0 src/main/java/org/jboss/modcluster/ha/HAModClusterServiceMBean.java
  104. +38 −0 src/main/java/org/jboss/modcluster/ha/HASingletonAwareResetRequestSource.java
  105. +152 −0 src/main/java/org/jboss/modcluster/ha/HASingletonAwareResetRequestSourceImpl.java
  106. +188 −0 src/main/java/org/jboss/modcluster/ha/ModClusterServiceDRMEntry.java
  107. +50 −0 src/main/java/org/jboss/modcluster/ha/rpc/BooleanGroupRpcResponse.java
  108. +49 −0 src/main/java/org/jboss/modcluster/ha/rpc/ClusteredMCMPHandlerRpcHandler.java
  109. +50 −0 src/main/java/org/jboss/modcluster/ha/rpc/GroupRpcResponse.java
  110. +53 −0 src/main/java/org/jboss/modcluster/ha/rpc/GroupRpcResponseFilter.java
  111. +53 −0 src/main/java/org/jboss/modcluster/ha/rpc/InetAddressGroupRpcResponse.java
  112. +51 −0 src/main/java/org/jboss/modcluster/ha/rpc/IntegerGroupRpcResponse.java
  113. +93 −0 src/main/java/org/jboss/modcluster/ha/rpc/MCMPServerDiscoveryEvent.java
  114. +41 −0 src/main/java/org/jboss/modcluster/ha/rpc/ModClusterServiceRpcHandler.java
  115. +81 −0 src/main/java/org/jboss/modcluster/ha/rpc/ModClusterServiceStateGroupRpcResponse.java
  116. +66 −0 src/main/java/org/jboss/modcluster/ha/rpc/PeerMCMPDiscoveryStatus.java
  117. +54 −0 src/main/java/org/jboss/modcluster/ha/rpc/ResetRequestGroupRpcResponse.java
  118. +37 −0 src/main/java/org/jboss/modcluster/ha/rpc/ResetRequestSourceRpcHandler.java
  119. +51 −0 src/main/java/org/jboss/modcluster/ha/rpc/StringGroupRpcResponse.java
  120. +60 −0 src/main/java/org/jboss/modcluster/ha/rpc/ThrowableGroupRpcResponse.java
  121. +34 −0 src/main/java/org/jboss/modcluster/load/LoadBalanceFactorProvider.java
  122. +31 −0 src/main/java/org/jboss/modcluster/load/LoadBalanceFactorProviderFactory.java
  123. +236 −0 src/main/java/org/jboss/modcluster/load/impl/DynamicLoadBalanceFactorProvider.java
  124. +63 −0 src/main/java/org/jboss/modcluster/load/impl/DynamicLoadBalanceFactorProviderMBean.java
  125. +53 −0 src/main/java/org/jboss/modcluster/load/impl/SimpleLoadBalanceFactorProvider.java
  126. +33 −0 src/main/java/org/jboss/modcluster/load/impl/SimpleLoadBalanceFactorProviderMBean.java
  127. +31 −0 src/main/java/org/jboss/modcluster/load/metric/LoadContext.java
  128. +46 −0 src/main/java/org/jboss/modcluster/load/metric/LoadMetric.java
  129. +47 −0 src/main/java/org/jboss/modcluster/load/metric/LoadMetricMBean.java
  130. +35 −0 src/main/java/org/jboss/modcluster/load/metric/LoadMetricSource.java
  131. +78 −0 src/main/java/org/jboss/modcluster/load/metric/impl/AbstractLoadMetric.java
  132. +51 −0 src/main/java/org/jboss/modcluster/load/metric/impl/ActiveSessionsLoadMetric.java
  133. +74 −0 src/main/java/org/jboss/modcluster/load/metric/impl/AverageSystemLoadMetric.java
  134. +52 −0 src/main/java/org/jboss/modcluster/load/metric/impl/BusyConnectorsLoadMetric.java
  135. +84 −0 src/main/java/org/jboss/modcluster/load/metric/impl/ConnectionPoolLoadMetricSource.java
  136. +52 −0 src/main/java/org/jboss/modcluster/load/metric/impl/ConnectionPoolUsageLoadMetric.java
  137. +48 −0 src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadState.java
  138. +60 −0 src/main/java/org/jboss/modcluster/load/metric/impl/HeapMemoryUsageLoadMetric.java
  139. +60 −0 src/main/java/org/jboss/modcluster/load/metric/impl/MBeanAttributeLoadMetric.java
  140. +73 −0 src/main/java/org/jboss/modcluster/load/metric/impl/MBeanAttributeRatioLoadMetric.java
  141. +67 −0 src/main/java/org/jboss/modcluster/load/metric/impl/MBeanLoadContext.java
  142. +58 −0 src/main/java/org/jboss/modcluster/load/metric/impl/MBeanLoadMetricSource.java
  143. +107 −0 src/main/java/org/jboss/modcluster/load/metric/impl/MBeanQueryLoadContext.java
  144. +62 −0 src/main/java/org/jboss/modcluster/load/metric/impl/MBeanQueryLoadMetricSource.java
  145. +59 −0 src/main/java/org/jboss/modcluster/load/metric/impl/OperatingSystemLoadMetricSource.java
  146. +63 −0 src/main/java/org/jboss/modcluster/load/metric/impl/ReceiveTrafficLoadMetric.java
  147. +64 −0 src/main/java/org/jboss/modcluster/load/metric/impl/RequestCountLoadMetric.java
  148. +87 −0 src/main/java/org/jboss/modcluster/load/metric/impl/RequestProcessorLoadMetricSource.java
  149. +61 −0 src/main/java/org/jboss/modcluster/load/metric/impl/SelfSourcedLoadMetric.java
  150. +65 −0 src/main/java/org/jboss/modcluster/load/metric/impl/SendTrafficLoadMetric.java
  151. +87 −0 src/main/java/org/jboss/modcluster/load/metric/impl/SessionLoadMetricSource.java
  152. +48 −0 src/main/java/org/jboss/modcluster/load/metric/impl/SourcedLoadMetric.java
  153. +76 −0 src/main/java/org/jboss/modcluster/load/metric/impl/SystemMemoryUsageLoadMetric.java
  154. +87 −0 src/main/java/org/jboss/modcluster/load/metric/impl/ThreadPoolLoadMetricSource.java
  155. +138 −0 src/main/java/org/jboss/modcluster/mbeans-descriptors.xml
  156. +83 −0 src/main/java/org/jboss/modcluster/mcmp/AbstractMCMPHandler.java
  157. +192 −0 src/main/java/org/jboss/modcluster/mcmp/MCMPHandler.java
  158. +43 −0 src/main/java/org/jboss/modcluster/mcmp/MCMPRequest.java
  159. +60 −0 src/main/java/org/jboss/modcluster/mcmp/MCMPRequestFactory.java
  160. +66 −0 src/main/java/org/jboss/modcluster/mcmp/MCMPRequestType.java
  161. +43 −0 src/main/java/org/jboss/modcluster/mcmp/MCMPServer.java
  162. +41 −0 src/main/java/org/jboss/modcluster/mcmp/MCMPServerState.java
  163. +42 −0 src/main/java/org/jboss/modcluster/mcmp/MCMPURLEncoder.java
  164. +62 −0 src/main/java/org/jboss/modcluster/mcmp/ResetRequestSource.java
  165. +1,354 −0 src/main/java/org/jboss/modcluster/mcmp/impl/DefaultMCMPHandler.java
  166. +92 −0 src/main/java/org/jboss/modcluster/mcmp/impl/DefaultMCMPRequest.java
  167. +289 −0 src/main/java/org/jboss/modcluster/mcmp/impl/DefaultMCMPRequestFactory.java
  168. +151 −0 src/main/java/org/jboss/modcluster/mcmp/impl/JSSEKeyManager.java
  169. +454 −0 src/main/java/org/jboss/modcluster/mcmp/impl/JSSESocketFactory.java
  170. +99 −0 src/main/java/org/jboss/modcluster/mcmp/impl/MCMPJBURLEncoder.java
  171. +121 −0 src/main/java/org/jboss/modcluster/mcmp/impl/MCMPTCURLEncoder.java
  172. +200 −0 src/main/java/org/jboss/modcluster/mcmp/impl/ResetRequestSourceImpl.java
  173. +309 −0 src/main/resources/mod-cluster-jboss-beans.xml
  174. +787 −0 src/test/java/org/jboss/modcluster/DefaultJBossWebEventHandlerTestCase.java
  175. +270 −0 src/test/java/org/jboss/modcluster/JBossWebEventHandlerAdapterTestCase.java
  176. +236 −0 src/test/java/org/jboss/modcluster/ModClusterListenerTestCase.java
  177. +215 −0 src/test/java/org/jboss/modcluster/ModClusterServiceTestCase.java
  178. +146 −0 src/test/java/org/jboss/modcluster/advertise/AdvertiseListenerImplTestCase.java
  179. +132 −0 src/test/java/org/jboss/modcluster/advertise/MulticastSocketFactoryImplTestCase.java
  180. +777 −0 src/test/java/org/jboss/modcluster/ha/ClusteredMCMPHandlerTestCase.java
  181. +1,034 −0 src/test/java/org/jboss/modcluster/ha/HAModClusterServiceTestCase.java
  182. +246 −0 src/test/java/org/jboss/modcluster/ha/HASingletonAwareResetRequestSourceTestCase.java
  183. +154 −0 src/test/java/org/jboss/modcluster/load/DynamicLoadBalanceFactorProviderTestCase.java
  184. +49 −0 src/test/java/org/jboss/modcluster/load/SimpleLoadBalanceFactorProviderTestCase.java
  185. +38 −0 src/test/java/org/jboss/modcluster/load/metric/ActiveSessionsLoadMetricTestCase.java
  186. +88 −0 src/test/java/org/jboss/modcluster/load/metric/AverageSystemLoadMetricTestCase.java
  187. +38 −0 src/test/java/org/jboss/modcluster/load/metric/BusyConnectorsLoadMetricTestCase.java
  188. +45 −0 src/test/java/org/jboss/modcluster/load/metric/ConnectionPoolLoadMetricSourceTestCase.java
  189. +39 −0 src/test/java/org/jboss/modcluster/load/metric/ConnectionPoolUsageLoadMetricTestCase.java
  190. +68 −0 src/test/java/org/jboss/modcluster/load/metric/HeapMemoryUsageLoadMetricTestCase.java
Sorry, we could not display the entire diff because it was too big.
9 .classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="src" output="target/demo/classes" path="src/demo/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
23 .project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>mod_cluster</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
104 JBossORG-EULA.txt
@@ -0,0 +1,104 @@
+LICENSE AGREEMENT
+JBOSS(r)
+
+This License Agreement governs the use of the Software Packages and any updates to the Software
+Packages, regardless of the delivery mechanism. Each Software Package is a collective work
+under U.S. Copyright Law. Subject to the following terms, Red Hat, Inc. ("Red Hat") grants to
+the user ("Client") a license to the applicable collective work(s) pursuant to the
+GNU Lesser General Public License v. 2.1 except for the following Software Packages:
+(a) JBoss Portal Forums and JBoss Transactions JTS, each of which is licensed pursuant to the
+GNU General Public License v.2;
+
+(b) JBoss Rules, which is licensed pursuant to the Apache License v.2.0;
+
+(c) an optional download for JBoss Cache for the Berkeley DB for Java database, which is licensed under the
+(open source) Sleepycat License (if Client does not wish to use the open source version of this database,
+it may purchase a license from Sleepycat Software);
+
+and (d) the BPEL extension for JBoss jBPM, which is licensed under the Common Public License v.1,
+and, pursuant to the OASIS BPEL4WS standard, requires parties wishing to redistribute to enter various
+royalty-free patent licenses.
+
+Each of the foregoing licenses is available at http://www.opensource.org/licenses/index.php.
+
+1. The Software. "Software Packages" refer to the various software modules that are created and made available
+for distribution by the JBoss.org open source community at http://www.jboss.org. Each of the Software Packages
+may be comprised of hundreds of software components. The end user license agreement for each component is located in
+the component's source code. With the exception of certain image files identified in Section 2 below,
+the license terms for the components permit Client to copy, modify, and redistribute the component,
+in both source code and binary code forms. This agreement does not limit Client's rights under,
+or grant Client rights that supersede, the license terms of any particular component.
+
+2. Intellectual Property Rights. The Software Packages are owned by Red Hat and others and are protected under copyright
+and other laws. Title to the Software Packages and any component, or to any copy, modification, or merged portion shall
+remain with the aforementioned, subject to the applicable license. The "JBoss" trademark, "Red Hat" trademark, the
+individual Software Package trademarks, and the "Shadowman" logo are registered trademarks of Red Hat and its affiliates
+in the U.S. and other countries. This agreement permits Client to distribute unmodified copies of the Software Packages
+using the Red Hat trademarks that Red Hat has inserted in the Software Packages on the condition that Client follows Red Hat's
+trademark guidelines for those trademarks located at http://www.redhat.com/about/corporate/trademark/. Client must abide by
+these trademark guidelines when distributing the Software Packages, regardless of whether the Software Packages have been modified.
+If Client modifies the Software Packages, then Client must replace all Red Hat trademarks and logos identified at
+http://www.jboss.com/company/logos unless a separate agreement with Red Hat is executed or other permission granted.
+Merely deleting the files containing the Red Hat trademarks may corrupt the Software Packages.
+
+3. Limited Warranty. Except as specifically stated in this Paragraph 3 or a license for a particular
+component, to the maximum extent permitted under applicable law, the Software Packages and the
+components are provided and licensed "as is" without warranty of any kind, expressed or implied,
+including the implied warranties of merchantability, non-infringement or fitness for a particular purpose.
+Red Hat warrants that the media on which Software Packages may be furnished will be free from defects in
+materials and manufacture under normal use for a period of 30 days from the date of delivery to Client.
+Red Hat does not warrant that the functions contained in the Software Packages will meet Client's requirements
+or that the operation of the Software Packages will be entirely error free or appear precisely as described
+in the accompanying documentation. This warranty extends only to the party that purchases the Services
+pertaining to the Software Packages from Red Hat or a Red Hat authorized distributor.
+
+4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable law, the remedies
+described below are accepted by Client as its only remedies. Red Hat's entire liability, and Client's
+exclusive remedies, shall be: If the Software media is defective, Client may return it within 30 days of
+delivery along with a copy of Client's payment receipt and Red Hat, at its option, will replace it or
+refund the money paid by Client for the Software. To the maximum extent permitted by applicable law,
+Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental or consequential
+damages, including lost profits or lost savings arising out of the use or inability to use the Software,
+even if Red Hat or such dealer has been advised of the possibility of such damages. In no event shall
+Red Hat's liability under this agreement exceed the amount that Client paid to Red Hat under this
+Agreement during the twelve months preceding the action.
+
+5. Export Control. As required by U.S. law, Client represents and warrants that it:
+(a) understands that the Software Packages are subject to export controls under the
+U.S. Commerce Department's Export Administration Regulations ("EAR");
+
+(b) is not located in a prohibited destination country under the EAR or U.S. sanctions regulations
+(currently Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria);
+
+(c) will not export, re-export, or transfer the Software Packages to any prohibited destination, entity,
+or individual without the necessary export license(s) or authorizations(s) from the U.S. Government;
+
+(d) will not use or transfer the Software Packages for use in any sensitive nuclear, chemical or
+biological weapons, or missile technology end-uses unless authorized by the U.S. Government by
+regulation or specific license;
+
+(e) understands and agrees that if it is in the United States and exports or transfers the Software
+Packages to eligible end users, it will, as required by EAR Section 740.17(e), submit semi-annual
+reports to the Commerce Department's Bureau of Industry & Security (BIS), which include the name and
+address (including country) of each transferee;
+
+and (f) understands that countries other than the United States may restrict the import, use, or
+export of encryption products and that it shall be solely responsible for compliance with any such
+import, use, or export restrictions.
+
+6. Third Party Programs. Red Hat may distribute third party software programs with the Software Packages
+that are not part of the Software Packages and which Client must install separately. These third party
+programs are subject to their own license terms. The license terms either accompany the programs or
+can be viewed at http://www.redhat.com/licenses/. If Client does not agree to abide by the applicable
+license terms for such programs, then Client may not install them. If Client wishes to install the programs
+on more than one system or transfer the programs to another party, then Client must contact the licensor
+of the programs.
+
+7. General. If any provision of this agreement is held to be unenforceable, that shall not affect the
+enforceability of the remaining provisions. This License Agreement shall be governed by the laws of the
+State of North Carolina and of the United States, without regard to any conflict of laws provisions,
+except that the United Nations Convention on the International Sale of Goods shall not apply.
+
+Copyright 2006-2007 Red Hat, Inc. All rights reserved.
+"JBoss" and the JBoss logo are registered trademarks of Red Hat, Inc.
+All other trademarks are the property of their respective owners.
33 README.txt
@@ -0,0 +1,33 @@
+mod-cluster
+===========
+
+Instructions
+------------
+
+JBoss AS
+
+1. Copy the exploded sar "mod-cluster.sar" directory into the deploy directory
+ of a JBoss server profile.
+2. Modify the server.xml within jbossweb.sar and add a clustered mode engine
+ listener as documented here:
+ http://www.jboss.org/mod_cluster/java/config.html
+
+
+JBoss Web
+
+1. Copy the jar file contained in the mod-cluster.sar directory into the lib
+ directory of your JBoss Web installation.
+2. Copy the following dependency jars into the same lib directory:
+
+3. Modify the server.xml within the conf directory and add a non-cluster mode
+ engine listener as documented here:
+ http://www.jboss.org/mod_cluster/java/config.html
+
+
+Additional notes for Tomcat
+
+1.
+
+
+This software is distributed under the terms of the FSF Lesser Gnu
+Public License (see lgpl.txt).
91 build-demo.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--======================================================================-->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!--======================================================================-->
+<project default="main" name="JBoss/mod_cluster Demo" xmlns:server="http://jboss.org/ns/test/ant/server">
+
+ <property environment="env"></property>
+
+ <!-- TODO: consolidate common properties with build-test.xml -->
+ <property name="module.output" location="${basedir}/target"/>
+ <property name="module.src" location="${basedir}/src"/>
+
+ <property name="demo.src" location="${module.src}/demo"/>
+ <property name="demo.src.java" location="${demo.src}/java"/>
+ <property name="demo.src.resources" location="${demo.src}/resources"/>
+ <property name="demo.output" location="${module.output}/demo"/>
+ <property name="demo.output.classes" location="${demo.output}/classes"/>
+ <property name="demo.output.client" location="${demo.output}/client"/>
+ <property name="demo.output.server" location="${demo.output}/server"/>
+ <property name="demo.client.jar" value="mod-cluster-demo.jar"></property>
+ <property name="demo.server.war" value="load-demo.war"></property>
+ <property name="demo.dependencies.lib" location="${module.output}/dependencies/lib"></property>
+
+ <path id="demo">
+ <fileset dir="${demo.dependencies.lib}" includes="*.jar"/>
+ </path>
+
+ <target name="main" depends="init, compile-demo">
+ <jar destfile="${demo.output.client}/lib/${demo.client.jar}">
+ <fileset dir="${demo.output.classes}" excludes="**/server/**"></fileset>
+ <manifest>
+ <attribute name="Main-Class" value="org.jboss.modcluster.demo.client.ModClusterDemo"/>
+ </manifest>
+ </jar>
+ <copy todir="${demo.output.client}">
+ <fileset dir="${demo.src.resources}">
+ <include name="run-demo.sh"/>
+ <include name="run-demo.bat"/>
+ </fileset>
+ </copy>
+ <copy todir="${demo.output.client}/lib">
+ <fileset dir="${demo.dependencies.lib}">
+ <include name="jcommon.jar"/>
+ <include name="jfreechart.jar"/>
+ </fileset>
+ </copy>
+ <war destfile="${demo.output.server}/${demo.server.war}" webxml="${demo.src.resources}/web.xml">
+ <classes dir="${demo.output.classes}" excludes="**/client/**"></classes>
+ <lib dir="${demo.dependencies.lib}">
+ <include name="commons-httpclient.jar"/>
+ <include name="commons-codec.jar"/>
+ </lib>
+ </war>
+
+ <fixcrlf srcdir="${demo.output.client}"
+ eol="lf" eof="remove"
+ includes="**/*.sh"/>
+
+ <fixcrlf srcdir="${demo.output.client}"
+ eol="crlf" eof="remove"
+ includes="**/*.bat, **/*.cmd"/>
+
+ <chmod perm="+x">
+ <fileset dir="${demo.output.client}">
+ <include name="**/*.sh"/>
+ </fileset>
+ </chmod>
+ </target>
+
+ <target name="init">
+ <mkdir dir="${demo.output}"/>
+ <mkdir dir="${demo.output.classes}"></mkdir>
+ <mkdir dir="${demo.output.client}"/>
+ <mkdir dir="${demo.output.client}/lib"/>
+ <mkdir dir="${demo.output.server}"/>
+ </target>
+
+ <target name="compile-demo">
+ <!-- Why doesn't this work without fork? -->
+ <javac destdir="${demo.output.classes}" srcdir="${demo.src.java}" classpathref="demo" fork="true"></javac>
+ </target>
+
+ <target name="run-demo" depends="main">
+ <java jar="${demo.output.client}/${demo.client.jar}" classpathref="demo" fork="true"></java>
+ </target>
+</project>
51 build-jbossweb.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!--
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Brian Stansberry
+ * @version $Revision$
+-->
+<project name="jbossweb" default="all" basedir=".">
+
+ <!-- See "build.properties.sample" in the top level directory for all -->
+ <!-- property values you must customize for successful building!!! -->
+ <property file="${user.home}/build.properties"/>
+ <property file="build.properties"/>
+
+ <property file="build.properties.default"/>
+
+ <property name="target.dir" value="${basedir}/target"/>
+ <property name="out.dir" value="${target.dir}/JBossWeb-Tomcat/"/>
+ <property name="out.lib" value="${out.dir}/lib"/>
+ <property name="dependencies.dir" value="${target.dir}/dependencies/lib/"/>
+
+
+ <target name="all">
+ <mkdir dir="${out.lib}"/>
+ <copy todir="${out.lib}">
+ <fileset dir="${dependencies.dir}">
+ <include name="jboss-logging-spi.jar"/>
+ <include name="jboss-logging-jdk.jar"/>
+ </fileset>
+ </copy>
+ <copy tofile="${out.lib}/mod-cluster.jar" file="${target.dir}/${mod-cluster.jar.name}.jar"/>
+ </target>
+</project>
443 build-test.xml
@@ -0,0 +1,443 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--======================================================================-->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!--======================================================================-->
+<project default="main" name="JBoss/mod_cluster Tests" xmlns:server="http://jboss.org/ns/test/ant/server">
+
+ <!-- ======================================================== -->
+ <!-- Initialization -->
+ <!-- ======================================================== -->
+ <tstamp>
+ <format property="TIMENOW" pattern="yyyy-MM-dd.HH-mm" timezone="GMT" />
+ </tstamp>
+ <echo message="${TIMENOW}" file="run.tstamp" />
+
+ <!-- =================== -->
+ <!-- Basic Configuration -->
+ <!-- =================== -->
+
+ <property name="results_web" value="http://jboss.sourceforge.net/junit-results/32" />
+ <property name="buildlog.level" value="info" />
+ <property environment="env" />
+
+ <!--
+ Set a hostname property based on COMPUTERNAME for win32, HOSTNAME
+ otherwise and initialize the node0/node1 cluster hostnames to
+ localhost and ${hostname} by default. If you cannot route multicast
+ traffic between localhost and hostname, then you need to specify node0
+ and node1 binding in the local.properties that can in order to be able
+ to run the clustering tests.
+ -->
+ <condition property="hostname" value="${env.COMPUTERNAME}">
+ <os family="windows" />
+ </condition>
+ <condition property="hostname" value="${env.HOSTNAME}">
+ <not>
+ <os family="windows" />
+ </not>
+ </condition>
+
+ <!--
+ We will use local.properties file to provide some configuration to the
+ testsuite mainly for the Clustering framework. Please do not checkin
+ your local.properties file into CVS
+ -->
+ <property file="local.properties" />
+
+ <!-- Cluster node defaults -->
+ <property name="node0" value="localhost" />
+ <property name="node0.http.url" value="http://${node0}:8080" />
+ <property name="node0.jndi.url" value="jnp://${node0}:1099" />
+ <property name="node0.jndi.port1.url" value="jnp://${node0}:1199" />
+ <property name="node0.http.port1.url" value="http://${node0}:8180" />
+ <property name="node0.jgroups.bind_addr" value="${node0}" />
+ <property name="node1" value="${hostname}" />
+ <property name="node1.http.url" value="http://${node1}:8080" />
+ <property name="node1.jndi.url" value="jnp://${node1}:1099" />
+ <property name="node1.jgroups.bind_addr" value="${node1}" />
+ <!--property name="node2" value="${env.MYTESTIP_3}" />
+ <property name="node2.http.url" value="http://${node2}:8080" />
+ <property name="node2.jndi.url" value="jnp://${node2}:1099" />
+ <property name="node2.jgroups.bind_addr" value="${node2}" />
+ <property name="node3" value="${env.MYTESTIP_4}" />
+ <property name="node3.http.url" value="http://${node3}:8080" />
+ <property name="node3.jndi.url" value="jnp://${node3}:1099" />
+ <property name="node3.jgroups.bind_addr" value="${node3}" /-->
+
+ <!-- UDP Group, must be done before server-config.xml -->
+ <!-- The value of the -u option passed to jboss -->
+ <!-- A blank value will prevent the -u option from being passed -->
+ <!--
+ Override this in the local.properties or pass to Ant as
+ -DupdGroup=128.x.x.x
+ -->
+ <property name="udpGroup" value="" />
+ <!-- Same thing, but passed to the client -->
+ <property name="jbosstest.udpGroup" value="${udpGroup}" />
+
+ <!-- Set "jboss.dist" to JBOSS_HOME -->
+ <property name="jboss.dist" value="${env.JBOSS_HOME}" />
+
+ <!-- Propagate the dist directory as a jbosstest system property -->
+ <property name="jbosstest.dist" value="${jboss.dist}" />
+
+ <!-- Externalized locations -->
+ <property name="location.resources.main" value="${basedir}/src/main/resources" />
+ <property name="location.resources.test" value="${basedir}/src/test/resources" />
+ <property name="location.target" value="${basedir}/target" />
+ <property name="location.artifact.tests" value="${location.target}/jboss-ejb3-testsuite-tests.jar" />
+ <property name="location.dependencies" value="${location.target}/dependencies" />
+ <property name="location.dependencies.unpacked" value="${location.dependencies}/unpacked" />
+ <property name="location.dependencies.unpacked.jboss-test:jboss.test" value="${location.dependencies.unpacked}/jboss-test" />
+ <property name="location.dependencies.lib" value="${location.dependencies}/lib" />
+ <property name="location.dependencies.lib.jboss-test:jboss-test" value="${location.dependencies.lib}/jboss-test.jar" />
+ <property name="location.dependencies.lib.org.jboss.jbossas:server-manager" value="${location.dependencies.lib}/jboss-server-manager.jar" />
+ <property name="location.dependencies.lib.junit:junit" value="${location.dependencies.lib}/junit.jar" />
+ <property name="location.dependencies.lib.apache-httpclient:commons-httpclient" value="${location.dependencies.lib}/commons-httpclient.jar" />
+ <property name="location.client.lib" value="${jboss.dist}/client"/>
+ <property name="location.apache.httpd" value="/usr/sbin"/>
+ <property name="location.apache.serverroot" value="${user.home}/httpd"/>
+ <property name="location.apache.config" value="conf/mod-cluster-httpd.conf"/>
+
+ <!-- Import the jboss server run targets -->
+ <import file="${location.dependencies.unpacked.jboss-test:jboss.test}/server-config.xml" />
+
+ <!-- Module name(s) & version -->
+ <property name="module.name" value="mod-cluster" />
+ <property name="module.Name" value="JBoss Testsuite" />
+ <property name="module.version" value="DEV" />
+ <property name="module.source" value="${basedir}/src" />
+ <property name="module.output" value="${basedir}/target" />
+
+ <!-- Where source files live -->
+ <property name="source.resources" value="${module.source}/test/resources"/>
+
+ <!-- Where build generated files will go -->
+ <property name="build.classes" value="${module.output}/classes"/>
+ <property name="build.lib" value="${module.output}/lib"/>
+ <property name="build.resources" value="${module.output}/resources"/>
+ <property name="build.reports" value="${module.output}/reports"/>
+ <property name="build.testlog" value="${module.output}/log"/>
+
+ <!-- Define common JVM Arguments for all mod-cluster JBossAS Runtimes -->
+ <property name="mod_cluster.jboss.jvmargs"
+ value="-Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dresolve.dns=false" />
+
+ <property name="junit.timeout" value="300000"/>
+
+ <!--
+ Define Server Configurations for mod_cluster Integration Tests
+ -->
+ <server:config javaHome="${env.JAVA_HOME}" jbossHome="${jboss.dist}"
+ udpGroup="${udpGroup}">
+
+ <server name="mod-cluster-0" host="${node0}">
+ <jvmarg value="${mod_cluster.jboss.jvmargs}" />
+ <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+ <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+ <sysproperty key="jboss.messaging.ServerPeerID" value="0" />
+ </server>
+
+ <server name="mod-cluster-1" host="${node1}">
+ <jvmarg value="${mod_cluster.jboss.jvmargs}" />
+ <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+ <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+ <sysproperty key="jboss.messaging.ServerPeerID" value="1" />
+ </server>
+
+ <server name="mod-cluster-2" host="${node2}">
+ <jvmarg value="${mod_cluster.jboss.jvmargs}" />
+ <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+ <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+ <sysproperty key="jboss.messaging.ServerPeerID" value="2" />
+ </server>
+
+ <server name="mod-cluster-3" host="${node3}">
+ <jvmarg value="${mod_cluster.jboss.jvmargs}" />
+ <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+ <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+ <sysproperty key="jboss.messaging.ServerPeerID" value="3" />
+ </server>
+
+ </server:config>
+
+ <!-- ===================== -->
+ <!-- Paths and Patternsets -->
+ <!-- ===================== -->
+
+ <!-- Define test Classpath -->
+ <path id="jboss.test.classpath">
+ <pathelement path="${jboss.test.path}" />
+ </path>
+
+ <!-- Classpath used by the Test Client -->
+ <path id="client.classpath">
+
+ <!-- JBoss Client Binaries -->
+
+ </path>
+
+ <!--
+ Define the Path to Server Task Definitions, used by the JBoss Server
+ Run targets
+ -->
+ <path id="server.taskdef.classpath">
+ <pathelement path="${location.dependencies.lib.jboss-test:jboss-test}" />
+ <pathelement
+ path="${location.dependencies.lib.org.jboss.jbossas:server-manager}" />
+ </path>
+
+ <patternset id="jboss.server.all.includes">
+ <include name="conf/**" />
+ <include name="deploy/**" />
+ <include name="deployers/**" />
+ <include name="deploy-hasingleton/**" />
+ <include name="lib/**" />
+ </patternset>
+
+ <!-- Define the test pattern sets Here -->
+ <patternset id="apache.integration.test.includes">
+ <include name="org/jboss/modcluster/test/*TestCase.class" />
+ </patternset>
+
+ <!-- Add exclude elements for any tests that should be excluded -->
+ <patternset id="badtest.excludes"/>
+
+ <!-- ============================================== -->
+ <!-- Macros -->
+ <!-- ============================================== -->
+
+ <macrodef name="httpd">
+ <attribute name="location" default="/usr/sbin"/>
+ <attribute name="action-type" default="start"/>
+ <attribute name="server-root"/>
+ <attribute name="config" default="conf/mod-cluster-httpd.conf"/>
+ <attribute name="failonerror" default="true"/>
+
+ <sequential>
+ <echo message="Will @{action-type} the apache instance at @{location} using -d @{server-root} -f @{config}"/>
+ <echo message="If you need apache to run on port 80, then"/>
+ <echo message="you need to start apache with admin/root rights."/>
+ <echo message="If so, start/stop apache independent of this testsuite"/>
+ <exec executable="@{location}/httpd"
+ failonerror="@{failonerror}" failifexecutionfails="@{failonerror}">
+ <arg value="-k"/>
+ <arg value="@{action-type}"/>
+ <arg value="-d"/>
+ <arg value="@{server-root}"/>
+ <arg value="-f"/>
+ <arg value="@{config}"/>
+ </exec>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="create-httpd">
+ <attribute name="server-root" description="the httpd serverroot to which newconf-src should be copied"/>
+ <attribute name="newconf-src" description="The name of the tests-config to copy"/>
+ <sequential>
+ <echo message="Updating httpd config at @{server-root}" />
+ <copy todir="@{server-root}" overwrite="true" failonerror="false">
+ <fileset dir="${build.resources}/test-configs/@{newconf-src}" />
+ </copy>
+ </sequential>
+ </macrodef>
+
+ <!-- ============================================== -->
+ <!-- Targets -->
+ <!-- ============================================== -->
+
+ <!-- Import the test jars build targets -->
+ <import file="test-jars.xml"/>
+
+ <!-- "main" is the default target; depends on "jars" which is imported
+ from test-jars.xml -->
+ <target name="main"
+ description="Executes the default target (jars)."
+ depends="jars"/>
+
+ <target name="init">
+ <record name="${basedir}/build.log" append="yes" action="start" loglevel="error"/>
+ </target>
+
+ <!-- Compile resource files -->
+ <target name="compile-resources">
+ <mkdir dir="${build.resources}"/>
+ <copy todir="${build.resources}" filtering="no">
+ <fileset dir="${source.resources}">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="tests-apache-integration"
+ description="Execute integration tests requiring an apache load balanced two JBoss nodes.">
+
+ <!-- Determine whether we are configured to ignore failures and
+ pass the appropriate property to tests-clustering-junit.
+ One property we check below and fail the build; the other is ignored.
+ -->
+ <condition property="apache.integration.junit.failure.property"
+ value="apache.integration.junit.failure"
+ else="apache.integration.junit.failure.ignored">
+ <and>
+ <isset property="ignore.integration.test.failures"/>
+ <equals arg1="${ignore.integration.test.failures}" arg2="true" casesensitive="false" trim="true"/>
+ </and>
+ </condition>
+
+ <echo message="Setting up httpd config in ${location.apache.serverroot}"/>
+ <create-httpd server-root="${location.apache.serverroot}" newconf-src="mod-cluster-httpd"/>
+
+ <create-config baseconf="all" newconf="mod-cluster-0" newconf-src="mod-cluster-jbossas">
+ <patternset id="jboss.server.all.includes">
+ <include name="conf/**" />
+ <include name="deploy/**" />
+ <include name="deployers/**" />
+ <include name="deploy-hasingleton/**" />
+ <include name="lib/**" />
+ </patternset>
+ </create-config>
+
+ <create-config baseconf="all" newconf="mod-cluster-1" newconf-src="mod-cluster-jbossas">
+ <patternset id="jboss.server.all.includes">
+ <include name="conf/**" />
+ <include name="deploy/**" />
+ <include name="deployers/**" />
+ <include name="deploy-hasingleton/**" />
+ <include name="lib/**" />
+ </patternset>
+ </create-config>
+
+ <httpd location="${location.apache.httpd}" server-root="${location.apache.serverroot}"
+ config="${location.apache.config}" action-type="start" />
+
+
+ <server:start name="mod-cluster-0" />
+ <server:start name="mod-cluster-1" />
+
+ <echo message="Nodes have started, waiting for cluster to stablize..." />
+
+ <echo message="Going to call target tests-clustering-unit" />
+
+ <antcall target="tests-clustering-unit">
+ <param name="cluster.includes.refid" value="apache.integration.test.includes" />
+ <param name="jboss-junit-configuration" value="ModCluster" />
+ <param name="tests-clustering-unit.failure.property" value="${apache.integration.junit.failure.property}"/>
+ </antcall>
+
+ <server:stop name="mod-cluster-0" />
+ <server:stop name="mod-cluster-1" />
+
+ <httpd location="${location.apache.httpd}" server-root="${location.apache.serverroot}"
+ config="${location.apache.config}" action-type="stop" />
+
+ <!-- See if junit set the failure property that triggers build failure -->
+ <fail message="JUnit tests failed; see test reports for details" if="apache.integration.junit.failure"/>
+
+ </target>
+
+ <!-- Executes a set of tests in a clustered environment -->
+ <target name="tests-clustering-unit">
+
+ <mkdir dir="${build.reports}" />
+ <mkdir dir="${build.testlog}" />
+ <junit dir="${module.output}" printsummary="on"
+ haltonerror="false" haltonfailure="false"
+ fork="true"
+ timeout="${junit.timeout}"
+ failureProperty="${tests-clustering-unit.failure.property}">
+
+ <sysproperty key="java.net.preferIPv4Stack" value="true" />
+
+ <sysproperty key="jboss.internal-server.serverroot"
+ value="${jboss.dist}/server" />
+ <sysproperty key="jbosstest.deploy.dir" file="${build.lib}" />
+ <sysproperty key="jbosstest.cluster.node0" value="${node0}" />
+ <sysproperty key="jbosstest.cluster.node0.http.url"
+ value="${node0.http.url}" />
+ <sysproperty key="jbosstest.cluster.node0.jndi.url"
+ value="${node0.jndi.url}" />
+ <sysproperty key="jbosstest.cluster.node0.serverroot"
+ value="${jboss.dist}/server/${jbosstest.cluster.node0.config}" />
+ <sysproperty key="jbosstest.cluster.node1" value="${node1}" />
+ <sysproperty key="jbosstest.cluster.node1.http.url"
+ value="${node1.http.url}" />
+ <sysproperty key="jbosstest.cluster.node1.jndi.url"
+ value="${node1.jndi.url}" />
+ <sysproperty key="jbosstest.cluster.node1.serverroot"
+ value="${jboss.dist}/server/${jbosstest.cluster.node1.config}" />
+ <sysproperty key="build.testlog" value="${build.testlog}" />
+ <sysproperty key="log4j.configuration" value="file:${build.resources}/log4j.xml" />
+ <!-- Pass along any jbosstest.* system properties -->
+ <syspropertyset>
+ <propertyref prefix="jbosstest." />
+ </syspropertyset>
+
+ <!--
+ Lets pass some parameters from local.properties file as system
+ properties
+ -->
+ <syspropertyset>
+ <propertyref prefix="org.apache." />
+ </syspropertyset>
+ <syspropertyset>
+ <propertyref prefix="apache" />
+ </syspropertyset>
+ <syspropertyset>
+ <propertyref prefix="node" />
+ </syspropertyset>
+
+ <!--
+ jvmarg value="${junit.jvm.options}"/> <jvmarg
+ value="-Xrunjdwp:transport=dt_socket,address=8789,server=y,suspend=y"/>
+ <jvmarg value="-Djava.compiler=NONE"/> <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/
+ -->
+
+ <classpath>
+ <pathelement location="${build.classes}" />
+ <pathelement location="${build.resources}" />
+ <path refid="tests.classpath" />
+ </classpath>
+
+ <!--
+ definition of the property for keeping results between configuration
+ -->
+ <sysproperty key="jboss-junit-configuration" value="${jboss-junit-configuration}" />
+ <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+ usefile="${junit.formatter.usefile}" extension="-${jboss-junit-configuration}.xml" />
+
+ <batchtest todir="${build.reports}" haltonerror="false"
+ haltonfailure="false" fork="true">
+
+ <fileset dir="${build.classes}">
+ <patternset refid="${cluster.includes.refid}" />
+ <patternset refid="badtest.excludes" />
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <!-- Launches a test assuming the AS instances are already running -->
+ <target name="one-cluster-test-nostart" if="test">
+
+ <property name="jboss-junit-configuration" value="ModCluster" />
+
+ <echo message="Going to call target tests-clustering-unit for ${test}" />
+
+ <antcall target="tests-clustering-unit">
+ <param name="cluster.includes.refid" value="one.test.includes" />
+ <param name="jboss-junit-configuration" value="${jboss-junit-configuration}" />
+ <param name="jbosstest.cluster.web.cache.config" value="standard-session-cache" />
+ <param name="jbosstest.cluster.node0.config" value="mod-cluster-0" />
+ <param name="jbosstest.cluster.node1.config" value="mod-cluster-1" />
+ </antcall>
+
+ </target>
+
+</project>
10 docs/README
@@ -0,0 +1,10 @@
+This is mod_cluster code (See http://wiki.jboss.org/wiki/ModClusterDesign).
+It is organized in the following subdirectories:
+docs (Documentation)
+native/mod_manager (manager part)
+native/mod_proxy_cluster (balancer for mod_proxy)
+native/include ( common includes like the table access layer API)
+native/mod_slotmem (shared memory provider).
+test/java (test utilities using httpclient).
+test/native (native test utilities).
+
165 lgpl.txt
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
84 local.properties
@@ -0,0 +1,84 @@
+#IMPORTANT:- Please do not check this file into CVS with your local changes
+#This file is used to pass config info to targets like apache_tomcat-clustering tests
+#Please uncomment or add your properties to this file.
+
+# $Id: local.properties 72339 2008-04-17 11:38:28Z adrian@jboss.org $
+
+### General compiler configuration ###
+
+# Use the jikes compiler
+#build.compiler=jikes
+
+# Use the eclipse compiler to allow for hot code swapping
+# http://www.jboss.org/index.html?module=bb&op=viewtopic&t=65783
+#
+# Make sure you have these jars in tools/lib
+#
+# org.eclipse.jdt.core_3.1.0.jar
+# jdtCompilerAdapter.jar (is contained in org.eclipse.jdt.core_3.1.0.jar)
+#
+#build.compiler=org.eclipse.jdt.core.JDTCompilerAdapter
+
+javac.optimize=false
+javac.debug=true
+javac.depend=false
+javac.verbose=false
+javac.deprecation=false
+javac.include.ant.runtime=true
+javac.include.java.runtime=false
+javac.fail.onerror=true
+
+junit.showoutput=true
+
+rmic.verify=true
+rmic.iiop=false
+rmic.iiopopts=
+rmic.idl=
+rmic.idlops=
+rmic.debug=true
+
+# Location of the httpd binary and the httpd serverroot
+#location.apache.httpd=/usr/sbin
+#location.apache.serverroot=${user.home}/httpd
+#location.apache.config=conf/mod-cluster-httpd.conf
+
+# Location of JBoss
+jboss.dist=${env.JBOSS_HOME}
+
+#
+# Both node0 and node1 properties are needed to run clustering tests.
+# e.g., tests-clustering. Note that you will need to have two separate ips
+# (even at the same machine). Actually what we needed are just node0 and node1
+# ips and the rest are optional.
+#
+#node0=${env.MYTESTIP_1}
+#node0.http.url=http://192.168.1.103:8080
+#node0.jndiurl=jnp://192.168.1.103:1099
+#node0.hajndi.url=jnp://192.168.1.103:1100
+
+#node1=${env.MYTESTIP_2}
+#node1.http.url=http://192.168.1.113:8080
+#node1.jndiurl=jnp://192.168.1.113:1099
+#node1.hajndi.url=jnp://192.168.1.113:1100
+
+# Set this to partition your testsuite runs
+# from others on the network.
+#udpGroup=${env.MY_UDP_GROUP}
+
+# In tests involving multicast, multicast packets by default have a TTL
+# of 0. Uncomment to set this to 1 if you find 0 prevents proper multicast
+# communication on your machine
+#jbosstest.udp.ip_ttl=1
+
+# Some DTM tests (e.g., dtm-tests) bring four JBoss instances up in order
+# to test transactions distributed across multiple servers. Those tests
+# need all four properties node0, node1, node2, and node3. Note that you
+# will need to have four separate ips (even at the same machine).
+#node2=${env.MYTESTIP_3}
+#node3=${env.MYTESTIP_4}
+
+#The following properties will reduce verbosity of Apache Commons HttpClient
+#org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
+#org.apache.commons.logging.simplelog.showdatetime=true
+#org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient=debug
+#org.apache.commons.logging.simplelog.log.httpclient.wire.header=error
0  native/advertise/.deps
No changes.
23 native/advertise/Makefile.in
@@ -0,0 +1,23 @@
+# Makefile.in for mod_proxy_cluster
+# copy the source in the httpd Apache source tree
+APACHE_BASE = @APACHE_BASE@
+top_builddir = @APACHE_BASE@
+# For .deps.
+builddir = @CLUSTER_BASE@
+# For the apache includes
+top_srcdir = @APACHE_BASE@
+
+include $(APACHE_BASE)/build/rules.mk
+SH_COMPILE = $(LIBTOOL) --mode=compile $(BASE_CC) -I../include -prefer-pic -c $< && touch $@
+
+all: mod_advertise.so
+
+mod_advertise.so: mod_advertise.la
+ $(APACHE_BASE)/build/instdso.sh SH_LIBTOOL='$(LIBTOOL)' mod_advertise.la `pwd`
+
+mod_advertise.la: mod_advertise.slo
+ $(SH_LINK) -rpath $(libexecdir) -module -avoid-version mod_advertise.lo
+
+clean:
+ rm -f *.o *.lo *.slo *.so
+ rm -rf .libs
17 native/advertise/README
@@ -0,0 +1,17 @@
+The source could be in httpd-2.2.x source tree.
+The ./buildconf must be run again amd the configure need at least:
+./configure --enable-advertise
+
+The source could build with a installed version of httpd-2-2.x:
+sh buildconf
+./configure --with-apache=apache_installation_directory.
+make
+The mod_advertise.so need to be copied to apache_installation_directory/modules
+
+Configuration use something like the following in httpd.conf:
+LoadModule advertise_module modules/mod_advertise.so
+ServerAdvertise on
+AdvertiseGroup 232.0.0.2
+AdvertiseFrequency 30
+
+Note default port is 23364.
12 native/advertise/buildconf
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+rm -rf aclocal.m4 autom4te*.cache
+
+echo "Creating configure ..."
+### do some work to toss config.cache?
+if ${AUTOCONF:-autoconf}; then
+ :
+else
+ echo "autoconf failed"
+ exit 1
+fi
24 native/advertise/configure.in
@@ -0,0 +1,24 @@
+dnl configure for mod_manager
+dnl
+
+AC_INIT(mod_advertise.c)
+
+AC_MSG_CHECKING(for Apache httpd installation)
+AC_ARG_WITH(apache,
+[ --with-apache[=DIR] DIR is the apache base installation
+],
+[ if test "$withval" = "yes"; then
+ withval=/usr/local/etc/httpd
+ fi
+ if test "$withval" != "no"; then
+ APACHE_BASE=$withval
+ else
+ AC_MSG_ERROR(mod_manager need a valid apache location)
+ fi
+],
+[ AC_MSG_ERROR(Please use --with-apache[=DIR])])
+CLUSTER_BASE=`pwd`
+
+AC_SUBST(APACHE_BASE)
+AC_SUBST(CLUSTER_BASE)
+AC_OUTPUT(Makefile)
702 native/advertise/mod_advertise.c
@@ -0,0 +1,702 @@
+/*
+ * ModAdvertise - Apache Httpd advertising module
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Mladen Turk
+ */
+
+#define CORE_PRIVATE
+
+#include "mod_advertise.h"
+#include "mod_core.h"
+#include "util_script.h"
+
+#ifndef MAX
+#define MAX(x,y) ((x) >= (y) ? (x) : (y))
+#endif
+
+#define MOD_SRVCONF(p) ap_get_module_config((p)->server->module_config, \
+ &advertise_module)
+#define MOD_GETCONF(s) ap_get_module_config((s)->module_config, \
+ &advertise_module)
+
+/*
+ * Declare ourselves so the configuration routines can find and know us.
+ * We'll fill it in at the end of the module.
+ */
+module AP_MODULE_DECLARE_DATA advertise_module;
+
+
+
+/*
+ * Server private data
+ */
+static int ma_generation = 0;
+static apr_time_t ma_child_started = 0;
+static pid_t ma_parent_pid = -1;
+
+/*
+ * Global configuration
+ */
+static int ma_manager_strict = 0;
+static int ma_advertise_set = 0;
+static int ma_advertise_run = 0;
+static int ma_advertise_stat = 0;
+static char *ma_advertise_adrs = MA_DEFAULT_GROUP;
+static char *ma_advertise_adsi = NULL;
+static char *ma_advertise_srvm = NULL;
+static char *ma_advertise_srvh = NULL;
+static char *ma_advertise_srvs = NULL;
+static char *ma_advertise_srvi = NULL;
+static char *ma_advertise_uuid = NULL;
+
+static char *ma_advertise_skey = NULL;
+
+
+static ma_advertise_srv_t ma_advs_server;
+
+
+/* Advertise is by default turned off */
+static apr_port_t ma_advertise_port = MA_DEFAULT_ADVPORT;
+static apr_port_t ma_advertise_srvp = 0;
+static ma_advertise_e ma_advertise_mode = ma_advertise_on;
+static apr_interval_time_t ma_advertise_freq = MA_DEFAULT_ADV_FREQ;
+
+/* Advertise sockets */
+static apr_socket_t *ma_mgroup_socket = NULL;
+static apr_socket_t *ma_listen_socket = NULL;
+static apr_sockaddr_t *ma_mgroup_sa = NULL;
+static apr_sockaddr_t *ma_listen_sa = NULL;
+
+static server_rec *ma_server_rec = NULL;
+
+/* Advertise sequence number */
+static volatile apr_int64_t ma_sequence = 0;
+
+
+/* Parent and child manager thread statuses */
+static volatile int is_mp_running = 0;
+static volatile int is_mp_created = 0;
+
+/*
+ * Server global data
+ */
+typedef struct ma_global_data_t {
+ int generation;
+ unsigned char ssalt[APR_MD5_DIGESTSIZE];
+ apr_uuid_t suuid;
+ char srvid[APR_UUID_FORMATTED_LENGTH + 2];
+ apr_pool_t *ppool;
+ apr_pool_t *cpool;
+} ma_global_data_t;
+
+/*
+ * Global data instance
+ * For parent, registered in process pool
+ */
+static ma_global_data_t *magd = NULL;
+
+/* Evaluates to true if the (apr_sockaddr_t *) addr argument is the
+ * IPv4 match-any-address, 0.0.0.0. */
+#define IS_INADDR_ANY(addr) ((addr)->family == APR_INET && \
+ (addr)->sa.sin.sin_addr.s_addr == INADDR_ANY)
+
+/* Evaluates to true if the (apr_sockaddr_t *) addr argument is the
+ * IPv6 match-any-address, [::]. */
+#define IS_IN6ADDR_ANY(addr) ((addr)->family == APR_INET6 && \
+ IN6_IS_ADDR_UNSPECIFIED(&(addr)->sa.sin6.sin6_addr))
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* ServerAdvertise directive */
+/* */
+/*--------------------------------------------------------------------------*/
+static const char *cmd_advertise_m(cmd_parms *cmd, void *dummy,
+ const char *arg, const char *opt)
+{
+
+ if (ma_advertise_srvs)
+ return "Duplicate ServerAdvertise directives are not allowed";
+
+ /* Virtual Host containing the directive */
+ if (ma_server_rec !=NULL && ma_server_rec != cmd->server)
+ return "All Advertise directives must be in the same VirtualHost";
+ if (ma_server_rec == NULL)
+ ma_server_rec = cmd->server;
+
+ if (strcasecmp(arg, "Off") == 0)
+ ma_advertise_mode = ma_advertise_off;
+ else if (strcasecmp(arg, "On") == 0)
+ ma_advertise_mode = ma_advertise_on;
+ else
+ return "ServerAdvertise must be Off or On";
+ if (opt) {
+ const char *p = ap_strstr_c(opt, "://");
+ if (p) {
+ ma_advertise_srvm = apr_pstrndup(cmd->pool, opt, p - opt);
+ opt = p + 3;
+ }
+ if (apr_parse_addr_port(&ma_advertise_srvs,
+ &ma_advertise_srvi,
+ &ma_advertise_srvp,
+ opt, cmd->pool) != APR_SUCCESS ||
+ !ma_advertise_srvs ||
+ !ma_advertise_srvp)
+ return "Invalid ServerAdvertise Address";
+ }
+ return NULL;
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* AdvertiseGroup directive */
+/* */
+/*--------------------------------------------------------------------------*/
+static const char *cmd_advertise_g(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ if (ma_server_rec !=NULL && ma_server_rec != cmd->server)
+ return "All Advertise directives must be in the same VirtualHost";
+ if (ma_server_rec == NULL)
+ ma_server_rec = cmd->server;
+
+ if (ma_advertise_set)
+ return "Duplicate AdvertiseGroup directives are not allowed";
+
+ if (apr_parse_addr_port(&ma_advertise_adrs,
+ &ma_advertise_adsi,
+ &ma_advertise_port,
+ arg, cmd->pool) != APR_SUCCESS)
+ return "Invalid AdvertiseGroup address";
+ if (!ma_advertise_adrs)
+ return "Missing Ip part from AdvertiseGroup address";
+ if (!ma_advertise_port)
+ ma_advertise_port = MA_DEFAULT_ADVPORT;
+ ma_advertise_set = 1;
+ return NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* AdvertiseFrequency directive */
+/* */
+/*--------------------------------------------------------------------------*/
+static const char *cmd_advertise_f(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ apr_time_t s, u = 0;
+ const char *p;
+
+ if (ma_server_rec !=NULL && ma_server_rec != cmd->server)
+ return "All Advertise directives must be in the same VirtualHost";
+ if (ma_server_rec == NULL)
+ ma_server_rec = cmd->server;
+
+ if (ma_advertise_freq != MA_DEFAULT_ADV_FREQ)
+ return "Duplicate AdvertiseFrequency directives are not allowed";
+ if ((p = ap_strchr_c(arg, '.')) || (p = ap_strchr_c(arg, ',')))
+ u = atoi(p + 1);
+
+ s = atoi(arg);
+ ma_advertise_freq = s * APR_USEC_PER_SEC + u * APR_TIME_C(1000);
+ if (ma_advertise_freq == 0)
+ return "Invalid AdvertiseFrequency value";
+
+ return NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* AdvertiseSecurityKey directive */
+/* */
+/*--------------------------------------------------------------------------*/
+static const char *cmd_advertise_k(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ if (ma_server_rec !=NULL && ma_server_rec != cmd->server)
+ return "All Advertise directives must be in the same VirtualHost";
+ if (ma_server_rec == NULL)
+ ma_server_rec = cmd->server;
+
+ if (ma_advertise_skey != NULL)
+ return "Duplicate AdvertiseSecurityKey directives are not allowed";
+ ma_advertise_skey = apr_pstrdup(cmd->pool, arg);
+ return NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* AdvertiseManagerUrl directive */
+/* */
+/*--------------------------------------------------------------------------*/
+static const char *cmd_advertise_h(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ if (ma_server_rec !=NULL && ma_server_rec != cmd->server)
+ return "All Advertise directives must be in the same VirtualHost";
+ if (ma_server_rec == NULL)
+ ma_server_rec = cmd->server;
+
+ if (ma_advertise_srvh != NULL)
+ return "Duplicate AdvertiseManagerUrl directives are not allowed";
+ ma_advertise_srvh = apr_pstrdup(cmd->pool, arg);
+ return NULL;
+}
+
+#define MA_ADVERTISE_SERVER_FMT \
+ "HTTP/1.0 %s" CRLF \
+ "Date: %s" CRLF \
+ "Sequence: %" APR_INT64_T_FMT CRLF \
+ "Digest: %s" CRLF \
+ "Server: %s" CRLF
+
+static const char *hex = "0123456789abcdef";
+
+apr_status_t ma_advertise_server(server_rec *server, int type)
+{
+ char buf[MA_BSIZE];
+ char dat[APR_RFC822_DATE_LEN];
+ unsigned char msig[APR_MD5_DIGESTSIZE];
+ unsigned char ssig[APR_MD5_DIGESTSIZE * 2 + 1];
+ const char *asl;
+ char *p = buf;
+ int i, c = 0;
+ apr_size_t l = MA_BSIZE - 8;
+ apr_size_t n = 0;
+ apr_md5_ctx_t md;
+
+ ma_sequence++;
+ if (ma_sequence < 1)
+ ma_sequence = 1;
+ sprintf(buf, "%" APR_INT64_T_FMT, ma_sequence);
+ ap_recent_rfc822_date(dat, apr_time_now());
+ asl = ap_get_status_line(ma_advertise_stat);
+
+ /* Create MD5 digest
+ * salt + date + sequence + srvid
+ */
+ apr_md5_init(&md);
+ apr_md5_update(&md, magd->ssalt, APR_MD5_DIGESTSIZE);
+ apr_md5_update(&md, dat, strlen(dat));
+ apr_md5_update(&md, buf, strlen(buf));
+ apr_md5_update(&md, magd->srvid + 1, strlen(magd->srvid) - 1);
+ apr_md5_final(msig, &md);
+ /* Convert MD5 digest to hex string */
+ for (i = 0; i < APR_MD5_DIGESTSIZE; i++) {
+ ssig[c++] = hex[msig[i] >> 4];
+ ssig[c++] = hex[msig[i] & 0x0F];
+ }
+ ssig[c] = '\0';
+ n = apr_snprintf(p, l, MA_ADVERTISE_SERVER_FMT,
+ asl, dat, ma_sequence, ssig, magd->srvid + 1);
+ if (type == MA_ADVERTISE_SERVER) {
+ l -= n;
+ n += apr_snprintf(p + n, l,
+ "X-Manager-Address: %s:%u" CRLF
+ "X-Manager-Url: %s" CRLF
+ "X-Manager-Protocol: %s" CRLF
+ "X-Manager-Host: %s" CRLF,
+ ma_advertise_srvs,
+ ma_advertise_srvp,
+ ma_advertise_srvh,
+ ma_advertise_srvm,
+ server->server_hostname);
+
+ }
+ strcat(p, CRLF);
+ n += 2;
+ return apr_socket_sendto(ma_mgroup_socket,
+ ma_mgroup_sa, 0, buf, &n);
+}
+
+static apr_status_t ma_group_join(const char *addr, apr_port_t port,
+ apr_pool_t *pool, server_rec *s)
+{
+ apr_status_t rv;
+
+ if ((rv = apr_sockaddr_info_get(&ma_mgroup_sa, addr,
+ APR_INET, port,
+ APR_UNSPEC, pool)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
+ "mod_advertise: ma_group_join apr_sockaddr_info_get failed");
+ return rv;
+ }
+ if ((rv = apr_socket_create(&ma_mgroup_socket,
+ ma_mgroup_sa->family,
+ SOCK_DGRAM,
+ APR_PROTO_UDP,
+ pool)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
+ "mod_advertise: ma_group_join apr_socket_create failed");
+ return rv;
+ }
+ if ((rv = apr_mcast_join(ma_mgroup_socket, ma_mgroup_sa,
+ NULL, NULL)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
+ "mod_advertise: ma_group_join apr_mcast_join failed");
+ apr_socket_close(ma_mgroup_socket);
+ return rv;
+ }
+ if ((rv = apr_mcast_hops(ma_mgroup_socket,
+ MA_ADVERTISE_HOPS)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
+ "mod_advertise: ma_group_join apr_mcast_hops failed");
+ apr_mcast_leave(ma_mgroup_socket, ma_mgroup_sa,
+ NULL, NULL);
+ apr_socket_close(ma_mgroup_socket);
+ return rv;
+ }
+ return APR_SUCCESS;
+}
+
+static void ma_group_leave()
+{
+ if (ma_mgroup_socket) {
+ apr_mcast_leave(ma_mgroup_socket, ma_mgroup_sa,
+ NULL, NULL);
+ apr_socket_close(ma_mgroup_socket);
+ ma_mgroup_socket = NULL;
+ }
+}
+
+static void * APR_THREAD_FUNC parent_thread(apr_thread_t *thd, void *data)
+{
+ static int current_status = 0;
+ int f_time = 1;
+ apr_interval_time_t a_step = 0;
+ server_rec *s = (server_rec *)data;
+ is_mp_created = 1;
+
+ while (is_mp_running) {
+ apr_sleep(MA_TM_RESOLUTION);
+ if (!is_mp_running)
+ break;
+ if (ma_advertise_run) {
+ a_step += MA_TM_RESOLUTION;
+ if (current_status != ma_advertise_stat) {
+ /* Force advertise on status change */
+ current_status = ma_advertise_stat;
+ f_time = 1;
+ }
+ if (a_step >= ma_advertise_freq || f_time) {
+ /* Run advertise */
+ ma_advertise_server(s, MA_ADVERTISE_SERVER);
+ a_step = 0;
+ f_time = 0;
+ }
+ if (!is_mp_running)
+ break;
+ }
+ /* TODO: Implement actual work for parent thread */
+ if (!is_mp_running)
+ break;
+ }
+ is_mp_created = 0;
+ return NULL;
+}
+
+static apr_status_t pconfig_cleanup(void *data);
+
+static apr_status_t process_cleanup(void *data)
+{
+ int advertise_run = ma_advertise_run;
+
+ is_mp_running = 0;
+ ma_advertise_run = 0;
+ if (advertise_run) {
+ ma_advertise_stat = HTTP_FORBIDDEN;
+ ma_advertise_server(ma_server_rec, MA_ADVERTISE_STATUS);
+ }
+ if (is_mp_created) {
+ apr_sleep(1000);
+ /* Wait for the parent maintenance thread to finish */
+ while (is_mp_created) {
+ apr_sleep(MA_TM_RESOLUTION);
+ }
+ }
+ if (advertise_run) {
+ ma_advertise_stat = HTTP_GONE;
+ ma_advertise_server(ma_server_rec, MA_ADVERTISE_STATUS);
+ ma_group_leave();
+ }
+ /* We don't need the post_config cleanup to run,
+ */
+ apr_pool_cleanup_kill(magd->cpool, magd, pconfig_cleanup);
+ magd = NULL;
+
+ return APR_SUCCESS;
+}
+
+static apr_status_t pconfig_cleanup(void *data)
+{
+ int advertise_run = ma_advertise_run;
+
+ is_mp_running = 0;
+ ma_advertise_run = 0;
+ if (advertise_run) {
+ ma_advertise_stat = HTTP_FORBIDDEN;
+ ma_advertise_server(ma_server_rec, MA_ADVERTISE_STATUS);
+ }
+
+ if (is_mp_created) {
+ apr_sleep(1000);
+ /* Wait for the parent maintenance thread to finish */
+ while (is_mp_created) {
+ apr_sleep(MA_TM_RESOLUTION);
+ }
+ }
+ if (advertise_run) {
+ ma_advertise_stat = HTTP_FORBIDDEN;
+ ma_advertise_server(ma_server_rec, MA_ADVERTISE_STATUS);
+ }
+ if (magd) {
+ /* Remove the process_cleanup.
+ * We need to reattach again because the
+ * module can be reloaded on different address
+ */
+ apr_pool_cleanup_kill(magd->ppool, magd, process_cleanup);
+ }
+ return APR_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* Post config hook. */
+/* Create management thread in parent and initializes Manager */
+/* */
+/*--------------------------------------------------------------------------*/
+static int post_config_hook(apr_pool_t *pconf, apr_pool_t *plog,
+ apr_pool_t *ptemp, server_rec *s)
+{
+ apr_status_t rv;
+ const char *pk = "advertise_init_module_tag";
+ apr_pool_t *pproc = s->process->pool;
+ apr_thread_t *tp;
+
+ apr_pool_userdata_get((void *)&magd, pk, pproc);
+ if (!magd) {
+ if (!(magd = apr_pcalloc(pproc, sizeof(ma_global_data_t))))
+ return apr_get_os_error();
+ apr_pool_create(&magd->ppool, pproc);
+ apr_pool_userdata_set(magd, pk, apr_pool_cleanup_null, pproc);
+ /* First time config phase -- skip. */
+ return OK;
+ }
+#if defined(WIN32)
+ {
+ const char *ppid = getenv("AP_PARENT_PID");
+ if (ppid) {
+ ma_parent_pid = atol(ppid);
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+ "[%" APR_PID_T_FMT " - %" APR_PID_T_FMT
+ "] in child post config hook",
+ getpid(), ma_parent_pid);
+ return OK;
+ }
+ }
+#endif
+ if (!magd->generation) {
+ /* Favor dynamic configuration */
+ if (ma_advertise_skey) {
+ apr_md5_ctx_t mc;
+ apr_md5_init(&mc);
+ apr_md5_update(&mc, ma_advertise_skey, strlen(ma_advertise_skey));
+ apr_md5_final(magd->ssalt, &mc);
+ }
+ apr_uuid_get(&magd->suuid);
+ magd->srvid[0] = '/';
+ apr_uuid_format(&magd->srvid[1], &magd->suuid);
+ }
+ if (!ma_advertise_srvh)
+ ma_advertise_srvh = magd->srvid;
+ /* Check if we have advertise set */
+ if (ma_advertise_mode != ma_advertise_off &&
+ ma_advertise_adrs) {
+ rv = ma_group_join(ma_advertise_adrs, ma_advertise_port, pconf, s);
+ if (rv != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
+ "mod_advertise: multicast join failed for %s:%d.",
+ ma_advertise_adrs, ma_advertise_port);
+ ma_advertise_run = 0;
+ }
+ else {
+ ma_advertise_run = 1;
+ ma_advertise_stat = 200;
+ }
+ }
+
+ /* Fill default values */
+ if (!ma_advertise_srvm) {
+ if (ma_server_rec && ma_server_rec->server_scheme) {
+ /* ServerName scheme://fully-qualified-domain-name[:port] */
+ ma_advertise_srvm = apr_pstrdup(pconf, ma_server_rec->server_scheme);
+ } else {
+ ma_advertise_srvm = apr_pstrdup(pconf, "http");
+ }
+ }
+
+ if (ma_advertise_srvs == NULL && ma_server_rec) {
+ /*
+ * That is not easy just use ServerAdvertise with the server parameter
+ * if the code below doesn't work
+ */
+ char *ptr;
+ int port = DEFAULT_HTTP_PORT;
+ if (ma_server_rec->addrs && ma_server_rec->addrs->host_addr &&
+ ma_server_rec->addrs->host_addr->next == NULL) {
+ ptr = apr_psprintf(pproc, "%pI", ma_server_rec->addrs->host_addr);
+ } else {
+ if ( ma_server_rec->port !=0 || ma_server_rec->port !=1)
+ port = ma_server_rec->port;
+ ptr = apr_psprintf(pproc, "%s:%lu", ma_server_rec->server_hostname, port);
+ }
+ rv = apr_parse_addr_port(&ma_advertise_srvs,
+ &ma_advertise_srvi,
+ &ma_advertise_srvp,
+ ptr, pproc);
+ if (rv != APR_SUCCESS || !ma_advertise_srvs ||
+ !ma_advertise_srvp) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
+ "mod_advertise: Invalid ServerAdvertise Address %s",
+ ptr);
+ return rv;
+ }
+ }
+
+ /* Create parent management thread */
+ is_mp_running = 1;
+ rv = apr_thread_create(&tp, NULL, parent_thread, s, pconf);
+ if (rv != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
+ "mod_advertise: parent apr_thread_create");
+ return rv;
+ }
+ apr_thread_detach(tp);
+
+ /* Create cleanup pool that will be destroyed first
+ * in future use new apr_pool_pre_cleanup_register from APR 1.3
+ */
+ apr_pool_create(&magd->cpool, pconf);
+ apr_pool_cleanup_register(magd->cpool, magd, pconfig_cleanup,
+ apr_pool_cleanup_null);
+
+ if (magd->generation++) {
+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
+ "Advertise reinitialized for process %" APR_PID_T_FMT,
+ getpid());
+ }
+ else {
+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
+ "Advertise initialized for process %" APR_PID_T_FMT,
+ getpid());
+ }
+
+ apr_pool_cleanup_register(magd->ppool, magd, process_cleanup,
+ apr_pool_cleanup_null);
+
+
+
+ return OK;
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* List of directives specific to our module. */
+/* */
+/*--------------------------------------------------------------------------*/
+static const command_rec cmd_table[] =
+{
+ AP_INIT_TAKE12(
+ "ServerAdvertise", /* directive name */
+ cmd_advertise_m, /* config action routine */
+ NULL, /* argument to include in call */
+ RSRC_CONF, /* where available */
+ "Server advertise mode: On | Off [Address]"
+ ),
+ AP_INIT_TAKE1(
+ "AdvertiseGroup", /* directive name */
+ cmd_advertise_g, /* config action routine */
+ NULL, /* argument to include in call */
+ RSRC_CONF, /* where available */
+ "Multicast group address"
+ ),
+ AP_INIT_TAKE1(
+ "AdvertiseFrequency", /* directive name */
+ cmd_advertise_f, /* config action routine */
+ NULL, /* argument to include in call */
+ RSRC_CONF, /* where available */
+ "Advertise frequency in seconds[.miliseconds]"
+ ),
+ AP_INIT_TAKE1(
+ "AdvertiseSecurityKey", /* directive name */
+ cmd_advertise_k, /* config action routine */
+ NULL, /* argument to include in call */
+ RSRC_CONF, /* where available */
+ "Advertise security key"
+ ),
+ AP_INIT_TAKE1(
+ "AdvertiseManagerUrl", /* directive name */
+ cmd_advertise_h, /* config action routine */
+ NULL, /* argument to include in call */
+ RSRC_CONF, /* where available */
+ "Advertise manager url"
+ ),
+ {NULL}
+
+};
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* Which functions are responsible for which hooks in the server. */
+/* */
+/*--------------------------------------------------------------------------*/
+static void register_hooks(apr_pool_t *p)
+{
+
+ /* Post config handling
+ */
+ ap_hook_post_config(post_config_hook,
+ NULL,
+ NULL,
+ APR_HOOK_LAST);
+
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* The list of callback routines and data structures that provide */
+/* the static hooks into our module from the other parts of the server. */
+/* */
+/*--------------------------------------------------------------------------*/
+module AP_MODULE_DECLARE_DATA advertise_module =
+{
+ STANDARD20_MODULE_STUFF,
+ NULL, /* per-directory config creator */
+ NULL, /* dir config merger */
+ NULL, /* server config creator */
+ NULL, /* server config merger */
+ cmd_table, /* command table */
+ register_hooks /* set up other request processing hooks */
+};
146 native/advertise/mod_advertise.h
@@ -0,0 +1,146 @@
+/*
+ * ModAdvertise - Apache Httpd advertising module
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Mladen Turk
+ */
+
+#ifndef MOD_ADVERTISE_H
+#define MOD_ADVERTISE_H
+
+/**
+ * @file mod_advertise.h
+ * @brief Advertise Module for Apache Httpd
+ *
+ * @defgroup MOD_ADVERTISE mod_advertise
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#define CORE_PRIVATE
+
+#include "apr_hooks.h"
+#include "apr.h"
+#include "apr_lib.h"
+#include "apr_strings.h"
+#include "apr_buckets.h"
+#include "apr_md5.h"
+#include "apr_network_io.h"
+#include "apr_pools.h"
+#include "apr_strings.h"
+#include "apr_uri.h"
+#include "apr_date.h"
+#include "apr_uuid.h"
+#include "apr_version.h"
+#include "apr_atomic.h"
+
+#define APR_WANT_STRFUNC
+#include "apr_want.h"
+
+#include "httpd.h"
+#include "http_config.h"
+#include "http_core.h"
+#include "http_protocol.h"
+#include "http_request.h"
+#include "http_vhost.h"
+#include "http_main.h"
+#include "http_log.h"
+#include "http_connection.h"
+#include "util_filter.h"
+#include "util_ebcdic.h"
+#include "util_time.h"
+#include "ap_provider.h"
+#include "ap_mpm.h"
+
+#if APR_HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if APR_HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if !APR_HAS_THREADS
+#error This module does not compile unless you have a thread capable APR!
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define MA_BSIZE 4096
+#define MA_SSIZE 1024
+#define MA_DEFAULT_ADVPORT 23364
+#define MA_DEFAULT_GROUP "224.0.1.105"
+#define MA_TM_RESOLUTION APR_TIME_C(100000)
+#define MA_DEFAULT_ADV_FREQ apr_time_from_sec(10)
+#define MA_TM_MAINTAIN_STEP 10
+
+/**
+ * Multicast Time to Live (ttl) for a advertise transmission.
+ */
+#define MA_ADVERTISE_HOPS 10
+
+/**
+ * Advertise protocol types
+ */
+#define MA_ADVERTISE_SERVER 0
+#define MA_ADVERTISE_STATUS 1
+
+/**
+ * Advertise mode enumeration.
+ */
+typedef enum {
+ ma_advertise_off,
+ ma_advertise_status,
+ ma_advertise_on
+} ma_advertise_e;
+
+/**
+ * Advertise header data structure
+ */
+typedef struct ma_advertise_hdr_t ma_advertise_hdr_t;
+struct ma_advertise_hdr_t {
+ int type;
+ apr_status_t status;
+ char suuid[APR_UUID_FORMATTED_LENGTH + 1];
+};
+
+/**
+ * Advertise server data structure
+ */
+typedef struct ma_advertise_srv_t ma_advertise_srv_t;
+struct ma_advertise_srv_t {
+ const char *handle;
+ const char *address;
+ const char *protocol;
+ server_rec *server;
+ apr_port_t port;
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+#endif /* MOD_ADVERTISE_H */
154 native/include/balancer.h
@@ -0,0 +1,154 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+#ifndef BALANCER_H
+#define BALANCER_H
+
+/**
+ * @file balancer.h
+ * @brief balancer description Storage Module for Apache
+ *
+ * @defgroup MEM balancers
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#define BALANCEREXE ".balancers"
+
+#ifndef MEM_T
+typedef struct mem mem_t;
+#define MEM_T
+#endif
+
+#include "mod_clustersize.h"
+
+/* status of the balancer as read/store in httpd. */
+struct balancerinfo {
+ char balancer[BALANCERSZ]; /* Name