|
[ https://issues.apache.org/jira/browse/SM-1839?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jean-Baptiste Onofré updated SM-1839: ------------------------------------- Fix Version/s: (was: 3.4.1) EOL-3 > Main entry improvement to allow run by procrun as Windows Service > ----------------------------------------------------------------- > > Key: SM-1839 > URL: https://issues.apache.org/jira/browse/SM-1839 > Project: ServiceMix > Issue Type: Improvement > Components: servicemix-core > Affects Versions: 3.3 > Environment: Windows 2000, 2003+ > Reporter: Jason Zhang > Assignee: Jean-Baptiste Onofré > Fix For: EOL-3 > > Attachments: Main.java > > > 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])) { > + 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) { -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira |
| Powered by Nabble | Edit this page |
