Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.3
-
None
-
Windows 2000, 2003+
-
Patch Available
Description
Basically, Apache Daemon procrun requires two entries, one for start and one for stop. org.apache.servicemix.Main only allow one entry. e.g. start. To use with procrun, Main.java need a bit of change to allow second entry (stop) and use this entry to unblock container. Here is the homemade patch for Main.java in trunk
Index: src/main/java/org/apache/servicemix/Main.java
===================================================================
— src/main/java/org/apache/servicemix/Main.java (revision 761422)
+++ src/main/java/org/apache/servicemix/Main.java (working copy)
@@ -33,7 +33,10 @@
- @version $Revision$
*/
public final class Main {
+
+ // singelton container
+ private static SpringJBIContainer container;
+
private Main() {
}
@@ -48,9 +51,18 @@
System.out.println();
final ApplicationContext context;
- if (args.length <= 0) {
+ if (args.length <= 0 || "start".equals(args[0])) { System.out.println("Loading Apache ServiceMix from servicemix.xml on the CLASSPATH"); context = new ClassPathXmlApplicationContext("servicemix.xml"); + }else if ("stop".equals(args[0]))
Unknown macro: {+ System.out.println("Stopping Apache ServiceMix");+ if (container != null){ + container.shutDown(); + container.destroy(); + }+ // return here may cause jni hangs waiting Worker thread finish+ // but procrun can fix it by setting --StopTimeout+ return; }else
{ String file = args[0]; @@ -65,7 +77,7 @@ System.out.println("Loading Apache ServiceMix from file: " + file); context = new FileSystemXmlApplicationContext(file, processors); } - SpringJBIContainer container = (SpringJBIContainer) context.getBean("jbi");
+ container = (SpringJBIContainer) context.getBean("jbi");
container.onShutDown(new Runnable() {
public void run() {
if (context instanceof DisposableBean) {