ServiceMix
  1. ServiceMix
  2. SM-1839

Main entry improvement to allow run by procrun as Windows Service

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.3
    • Fix Version/s: 3.4.2
    • Component/s: servicemix-core
    • Labels:
      None
    • Environment:

      Windows 2000, 2003+

    • Patch Info:
      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) {
      1. Main.java
        4 kB
        Jason Zhang

        Activity

        Jean-Baptiste Onofré made changes -
        Fix Version/s EOL-3 [ 12321940 ]
        Fix Version/s 3.4.1 [ 12316284 ]
        Jean-Baptiste Onofré made changes -
        Fix Version/s 3.5 [ 12316284 ]
        Fix Version/s 3.3.4 [ 12316200 ]
        Jean-Baptiste Onofré made changes -
        Fix Version/s 3.3.4 [ 12316200 ]
        Fix Version/s 3.3.3 [ 12315728 ]
        Jean-Baptiste Onofré made changes -
        Assignee Jean-Baptiste Onofré [ jbonofre ]
        Jeff Turner made changes -
        Project Import Sat Nov 27 00:46:19 EST 2010 [ 1290836779991 ]
        Jean-Baptiste Onofré made changes -
        Fix Version/s 3.3.3 [ 12301 ]
        Fix Version/s 3.3.2 [ 12152 ]
        Lars Heinemann made changes -
        Fix Version/s 3.3.1 [ 11978 ]
        Fix Version/s 3.3.2 [ 12152 ]
        Jason Zhang made changes -
        Field Original Value New Value
        Attachment Main.java [ 17879 ]
        Jason Zhang created issue -

          People

          • Assignee:
            Jean-Baptiste Onofré
            Reporter:
            Jason Zhang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development