mainsvc.java

来自「java开源的企业总线.xmlBlaster」· Java 代码 · 共 76 行

JAVA
76
字号
/*------------------------------------------------------------------------------Name:      MainSvc.javaProject:   xmlBlaster.orgCopyright: xmlBlaster.org, see xmlBlaster-LICENSE fileComment:   Main class to invoke the xmlBlaster serverVersion:   $Id: MainSvc.java 14841 2006-03-06 23:58:27Z ruff $------------------------------------------------------------------------------*/package org.xmlBlaster;import com.silveregg.wrapper.WrapperManager;import com.silveregg.wrapper.WrapperListener;import java.util.logging.Level;import org.xmlBlaster.engine.*;import org.xmlBlaster.util.XmlBlasterException;public class MainSvc implements WrapperListener {	private Main main = null;        /**************************************************************************     * WrapperListener Methods     *************************************************************************/    public Integer start(String[] args) {        System.out.println("start()");                final String[] myArgs = args;        WrapperManager.signalStarting(20000);                Thread startThread = new Thread() {            public void run() {                ServerScope glob = new ServerScope(myArgs);                try {                    glob.getProperty().set("doBlocking", "false");                }catch(XmlBlasterException ex) {                }                main = new Main(glob);                while (!main.isHalted()) try { Thread.sleep(60*1000); } catch (Exception e) {}            }        };        startThread.start();                return null;    }        public int stop(int exitCode) {        System.out.println("stop(" + exitCode + ")");	  if (main != null) main.shutdown();        main = null;                return exitCode;    }        public void controlEvent(int event) {        System.out.println("controlEvent(" + event + ")");        if (event == WrapperManager.WRAPPER_CTRL_C_EVENT) {            WrapperManager.stop(0);        }    }        /**************************************************************************     * Main Method     *************************************************************************/    public static void main(String[] args) {        System.out.println("Initializing...");                // Start the application.  If the JVM was launched from the native        //  Wrapper then the application will wait for the native Wrapper to        //  call the application's start method.  Otherwise the start method        //  will be called immediately.        WrapperManager.start(new MainSvc(), args);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?