瀏覽代碼

任务暂停,恢复

benjobs 7 年之前
父節點
當前提交
aceca5940f

+ 112 - 34
build.sh

@@ -25,6 +25,117 @@ cat<<EOT
 EOT
 echo -ne "${RES}";
 
+echo_r () {
+    # Color red: Error, Failed
+    [ $# -ne 1 ] && return 1
+    echo -e "[${GREEN_COLOR}opencron${RES}] ${RED_COLOR}$1${RES}"
+}
+
+echo_g () {
+    # Color green: Success
+    [ $# -ne 1 ] && return 1
+    echo -e "[${GREEN_COLOR}opencron${RES}] ${GREEN_COLOR}$1${RES}"
+}
+
+echo_y () {
+    # Color yellow: Warning
+    [ $# -ne 1 ] && return 1
+    echo -e "[${GREEN_COLOR}opencron${RES}] ${YELLOW_COLOR}$1${RES}"
+}
+
+echo_w () {
+    # Color yellow: White
+    [ $# -ne 1 ] && return 1
+    echo -e "[${GREEN_COLOR}opencron${RES}] ${WHITE_COLOR}$1${RES}"
+}
+
+
+# Make sure prerequisite environment variables are set
+if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
+  if $darwin; then
+    # Bugzilla 54390
+    if [ -x '/usr/libexec/java_home' ] ; then
+      export JAVA_HOME=`/usr/libexec/java_home`
+    # Bugzilla 37284 (reviewed).
+    elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then
+      export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
+    fi
+  else
+    JAVA_PATH=`which java 2>/dev/null`
+    if [ "x$JAVA_PATH" != "x" ]; then
+      JAVA_PATH=`dirname $JAVA_PATH 2>/dev/null`
+      JRE_HOME=`dirname $JAVA_PATH 2>/dev/null`
+    fi
+    if [ "x$JRE_HOME" = "x" ]; then
+      # XXX: Should we try other locations?
+      if [ -x /usr/bin/java ]; then
+        JRE_HOME=/usr
+      fi
+    fi
+  fi
+  if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
+    echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
+    echo "At least one of these environment variable is needed to run this program"
+    exit 1
+  fi
+fi
+if [ -z "$JAVA_HOME" -a "$1" = "debug" ]; then
+  echo "JAVA_HOME should point to a JDK in order to run in debug mode."
+  exit 1
+fi
+if [ -z "$JRE_HOME" ]; then
+  JRE_HOME="$JAVA_HOME"
+fi
+
+# If we're running under jdb, we need a full jdk.
+if [ "$1" = "debug" ] ; then
+  if [ "$os400" = "true" ]; then
+    if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/javac ]; then
+      echo "The JAVA_HOME environment variable is not defined correctly"
+      echo "This environment variable is needed to run this program"
+      echo "NB: JAVA_HOME should point to a JDK not a JRE"
+      exit 1
+    fi
+  else
+    if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HOME"/bin/javac ]; then
+      echo "The JAVA_HOME environment variable is not defined correctly"
+      echo "This environment variable is needed to run this program"
+      echo "NB: JAVA_HOME should point to a JDK not a JRE"
+      exit 1
+    fi
+  fi
+fi
+
+# Don't override the endorsed dir if the user has set it previously
+if [ -z "$JAVA_ENDORSED_DIRS" ]; then
+  # Set the default -Djava.endorsed.dirs argument
+  JAVA_ENDORSED_DIRS="$OPENCRON_HOME"/endorsed
+fi
+
+# Set standard commands for invoking Java, if not already set.
+if [ -z "$RUNJAVA" ]; then
+  RUNJAVA="$JRE_HOME"/bin/java
+fi
+if [ "$os400" != "true" ]; then
+  if [ -z "$_RUNJDB" ]; then
+    _RUNJDB="$JAVA_HOME"/bin/jdb
+  fi
+fi
+
+#check java exists.
+$RUNJAVA >/dev/null 2>&1
+
+if [ $? -ne 1 ];then
+  echo_r "ERROR: java is not install,please install java first!"
+  exit 1;
+fi
+
+#check openjdk
+if [ "`${RUNJAVA} -version 2>&1 | head -1|grep "openjdk"|wc -l`"x == "1"x ]; then
+  echo_r "ERROR: please uninstall OpenJDK and install jdk first"
+  exit 1;
+fi
+
 # OS specific support.  $var _must_ be set to either true or false.
 cygwin=false
 darwin=false
@@ -48,6 +159,7 @@ while [ -h "$PRG" ]; do
   fi
 done
 
+
 # Get standard environment variables
 PRGDIR=`dirname "$PRG"`
 
@@ -59,8 +171,6 @@ MAVEN_NAME="apache-maven-3.5.2-bin"
 
 UNPKG_MAVEN_NAME="apache-maven-3.5.2";
 
-
-
 OPENCRON_VERSION="1.1.0-RELEASE";
 
 MAVEN_PATH="/tmp";
@@ -69,44 +179,12 @@ MAVEN_PATH="/tmp";
 
 DIST_HOME="${WORKDIR}/dist"
 
-echo_r () {
-    # Color red: Error, Failed
-    [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${RED_COLOR}$1${RES}"
-}
-
-echo_g () {
-    # Color green: Success
-    [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${GREEN_COLOR}$1${RES}"
-}
-
-echo_y () {
-    # Color yellow: Warning
-    [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${YELLOW_COLOR}$1${RES}"
-}
-
-echo_w () {
-    # Color yellow: White
-    [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${WHITE_COLOR}$1${RES}"
-}
-
 USER="`id -un`"
 LOGNAME="$USER"
 if [ $UID -ne 0 ]; then
     echo_y "WARNING: Running as a non-root user, \"$LOGNAME\". Functionality may be unavailable. Only root can use some commands or options"
 fi
 
-#check java exists.
-java >/dev/null 2>&1
-
-if [ $? -ne 1 ];then
-  echo_r "ERROR: java is not install,please install java first!"
-  exit 1;
-fi
-
 #check maven exists
 mvn >/dev/null 2>&1
 

+ 16 - 6
opencron-agent/src/conf/bin/opencron.sh

@@ -39,7 +39,7 @@
 #                   used
 # -----------------------------------------------------------------------------
 
-# opencron logo...
+#echo color
 GREEN_COLOR="\E[1;32m";
 RES="\E[0m";
 
@@ -127,10 +127,6 @@ case $OPENCRON_BASE in
 esac
 
 
-
-
-
-
 # For OS400
 if $os400; then
   # Set job priority to standard for interactive (interactive - 6) by using
@@ -160,6 +156,20 @@ else
   fi
 fi
 
+#check java exists.
+$RUNJAVA >/dev/null 2>&1
+
+if [ $? -ne 1 ];then
+  echo_r "ERROR: java is not install,please install java first!"
+  exit 1;
+fi
+
+#check openjdk
+if [ "`${RUNJAVA} -version 2>&1 | head -1|grep "openjdk"|wc -l`"x == "1"x ]; then
+  echo_r "ERROR: please uninstall OpenJDK and install jdk first"
+  exit 1;
+fi
+
 
 if [ -z "$OPENCRON_OUT" ] ; then
   OPENCRON_OUT="$OPENCRON_BASE"/logs/opencron.out
@@ -177,7 +187,7 @@ OPENCRON_PIDDIR="/var/run";
 OPENCRON_PID="$OPENCRON_PIDDIR/opencron.pid";
 
 #opencron version
-OPENCRON_VERSION="1.1.0-RELEASE"
+OPENCRON_VERSION="1.2.0-RELEASE"
 
 # Add bootstrap.jar to classpath
 if [ ! -z "$CLASSPATH" ] ; then

+ 27 - 27
opencron-server/pom.xml

@@ -126,163 +126,163 @@
                         <dependency>
                             <groupId>javax.servlet</groupId>
                             <artifactId>javax.servlet-api</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>javax.servlet.jsp</groupId>
                             <artifactId>jsp-api</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty</groupId>
                             <artifactId>jetty-util</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty</groupId>
                             <artifactId>jetty-webapp</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty</groupId>
                             <artifactId>jetty-server</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty.websocket</groupId>
                             <artifactId>websocket-server</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty.websocket</groupId>
                             <artifactId>websocket-servlet</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty.websocket</groupId>
                             <artifactId>websocket-common</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty.websocket</groupId>
                             <artifactId>websocket-api</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty</groupId>
                             <artifactId>jetty-servlet</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty</groupId>
                             <artifactId>apache-jsp</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.mortbay.jasper</groupId>
                             <artifactId>apache-jsp</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.mortbay.jasper</groupId>
                             <artifactId>apache-el</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty</groupId>
                             <artifactId>jetty-http</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty</groupId>
                             <artifactId>jetty-io</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty</groupId>
                             <artifactId>jetty-xml</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jetty</groupId>
                             <artifactId>jetty-security</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jdt.core.compiler</groupId>
                             <artifactId>ecj</artifactId>
-                            <outputDirectory>${project.build.directory}/../jetty</outputDirectory>
+                            <outputDirectory>${basedir}/work/jetty</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>javax.servlet</groupId>
                             <artifactId>javax.servlet-api</artifactId>
-                            <outputDirectory>${project.build.directory}/../tomcat</outputDirectory>
+                            <outputDirectory>${basedir}/work/tomcat</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>javax.servlet.jsp</groupId>
                             <artifactId>jsp-api</artifactId>
-                            <outputDirectory>${project.build.directory}/../tomcat</outputDirectory>
+                            <outputDirectory>${basedir}/work/tomcat</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.apache.tomcat.embed</groupId>
                             <artifactId>tomcat-embed-core</artifactId>
-                            <outputDirectory>${project.build.directory}/../tomcat</outputDirectory>
+                            <outputDirectory>${basedir}/work/tomcat</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.apache.tomcat.embed</groupId>
                             <artifactId>tomcat-embed-el</artifactId>
-                            <outputDirectory>${project.build.directory}/../tomcat</outputDirectory>
+                            <outputDirectory>${basedir}/work/tomcat</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.apache.tomcat.embed</groupId>
                             <artifactId>tomcat-embed-jasper</artifactId>
-                            <outputDirectory>${project.build.directory}/../tomcat</outputDirectory>
+                            <outputDirectory>${basedir}/work/tomcat</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.eclipse.jdt.core.compiler</groupId>
                             <artifactId>ecj</artifactId>
-                            <outputDirectory>${project.build.directory}/../tomcat</outputDirectory>
+                            <outputDirectory>${basedir}/work/tomcat</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.apache.tomcat.embed</groupId>
                             <artifactId>tomcat-embed-websocket</artifactId>
-                            <outputDirectory>${project.build.directory}/../tomcat</outputDirectory>
+                            <outputDirectory>${basedir}/work/tomcat</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.apache.tomcat.embed</groupId>
                             <artifactId>tomcat-embed-logging-juli</artifactId>
-                            <outputDirectory>${project.build.directory}/../tomcat</outputDirectory>
+                            <outputDirectory>${basedir}/work/tomcat</outputDirectory>
                         </dependency>
 
                         <dependency>
                             <groupId>org.apache.tomcat.embed</groupId>
                             <artifactId>tomcat-embed-logging-log4j</artifactId>
-                            <outputDirectory>${project.build.directory}/../tomcat</outputDirectory>
+                            <outputDirectory>${basedir}/work/tomcat</outputDirectory>
                         </dependency>
 
                     </artifactItems>

+ 27 - 17
opencron-server/src/main/java/org/opencron/server/bootstrap/JettyLauncher.java

@@ -4,56 +4,66 @@ package org.opencron.server.bootstrap;
 import org.apache.tomcat.util.scan.StandardJarScanner;
 import org.eclipse.jetty.apache.jsp.JettyJasperInitializer;
 import org.eclipse.jetty.jsp.JettyJspServlet;
+import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.util.component.AbstractLifeCycle;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.eclipse.jetty.webapp.WebAppContext;
+import org.opencron.common.utils.CommonUtils;
 import org.opencron.common.utils.MavenUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class JettyLauncher implements Launcher {
 
-    private  Logger logger = LoggerFactory.getLogger(Startup.class);
+    private Logger logger = LoggerFactory.getLogger(JettyLauncher.class);
 
-    public void start(boolean devMode,int port) {
+    public void start(boolean devMode, int port) throws Exception {
 
-        Server server = new Server(port);
+        Server server = new Server(new QueuedThreadPool(500));
 
         WebAppContext appContext = new WebAppContext();
 
+        String resourceBasePath = "";
         //开发者模式
         if (devMode) {
             String artifact = MavenUtils.get(Thread.currentThread().getContextClassLoader()).getArtifactId();
-            String baseDir = "./".concat(artifact);
-            appContext.setDescriptor(baseDir + "/src/main/webapp/WEB-INF/web.xml");
-            appContext.setResourceBase(baseDir + "/src/main/webapp");
-        }else {
-            appContext.setDescriptor("./WEB-INF/web.xml");
-            appContext.setResourceBase("./");
+            resourceBasePath = artifact + "/src/main/webapp";
         }
+        appContext.setDescriptor(resourceBasePath + "WEB-INF/web.xml");
+        appContext.setResourceBase(resourceBasePath);
+        appContext.setExtractWAR(true);
 
         //init param
-        appContext.setThrowUnavailableOnStartupException(true);    // 在启动过程中允许抛出异常终止启动并退出 JVM
         appContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
-        appContext.setInitParameter("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");
+        if (CommonUtils.isWindowOs()) {
+            appContext.setInitParameter("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");
+        }
 
         //for jsp support
         appContext.addBean(new JettyJspParser(appContext));
         appContext.addServlet(JettyJspServlet.class, "*.jsp");
 
         appContext.setContextPath("/");
+        appContext.getServletContext().setExtendedListenerTypes(true);
         appContext.setParentLoaderPriority(true);
+        appContext.setThrowUnavailableOnStartupException(true);
+        appContext.setConfigurationDiscovered(true);
         appContext.setClassLoader(Thread.currentThread().getContextClassLoader());
 
+        ServerConnector connector = new ServerConnector(server);
+        connector.setHost("0.0.0.0");
+        connector.setPort(port);
+        server.setConnectors(new Connector[]{connector});
+        server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", 1024 * 1024 * 1024);
+        server.setDumpAfterStart(false);
+        server.setDumpBeforeStop(false);
         server.setStopAtShutdown(true);
         server.setHandler(appContext);
-        try {
-            logger.info("[opencron] JettyLauncher starting...");
-            server.start();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+        logger.info("[opencron] JettyLauncher starting...");
+        server.start();
     }
     @Override
     public void stop() {

+ 10 - 6
opencron-server/src/main/java/org/opencron/server/bootstrap/Startup.java

@@ -3,6 +3,8 @@ package org.opencron.server.bootstrap;
 import org.opencron.common.utils.ExtClasspathLoader;
 import org.opencron.common.utils.MavenUtils;
 
+import java.io.File;
+
 public class Startup {
 
     private static final int MIN_PORT = 0;
@@ -13,6 +15,8 @@ public class Startup {
 
     private static boolean devMode = true;
 
+    private static final String workspace = "work";
+
     public static void main(String[] args) throws Exception {
 
         String portParam = System.getProperty("server.port");
@@ -39,12 +43,12 @@ public class Startup {
 
         String jarPath;
         if (devMode) {
-            String artifact =  MavenUtils.get(Thread.currentThread().getContextClassLoader()).getArtifactId();
-            jarPath = "./".concat(artifact).concat("/").concat(launcher);
-            System.setProperty("catalina.home","./".concat(artifact));
-        }else {
-            jarPath = "./".concat(launcher);
-            System.setProperty("catalina.home","./");
+            String artifact = MavenUtils.get(Thread.currentThread().getContextClassLoader()).getArtifactId();
+            jarPath = artifact + File.separator + workspace + File.separator + launcher;
+            System.setProperty("catalina.home", artifact + File.separator + workspace);
+        } else {
+            jarPath = workspace + File.separator + launcher;
+            System.setProperty("catalina.home", workspace);
         }
         //load jars.
         ExtClasspathLoader.scanJar(jarPath);

+ 36 - 16
opencron-server/src/main/java/org/opencron/server/bootstrap/TomcatLauncher.java

@@ -1,43 +1,63 @@
 package org.opencron.server.bootstrap;
 
 
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.core.AprLifecycleListener;
 import org.apache.catalina.core.StandardServer;
+import org.apache.catalina.core.StandardThreadExecutor;
 import org.apache.catalina.startup.Tomcat;
 import org.opencron.common.utils.MavenUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.File;
 
 public class TomcatLauncher implements Launcher {
 
+
+    private static final String currentPath = "";
+
+    private Logger logger = LoggerFactory.getLogger(TomcatLauncher.class);
+
     @Override
     public void start(boolean devMode,int port) throws Exception {
 
-        //get webapp path...
-        File webApp = new File("./");
-        String baseDir = ".";
+        String baseDir = currentPath;
+        File webApp = new File(currentPath);
+
         if (devMode) {
             String artifact = MavenUtils.get(Thread.currentThread().getContextClassLoader()).getArtifactId();
-            baseDir = "./".concat(artifact);
-            String webAppPath = baseDir.concat("/src/main/webapp/");
-            webApp = new File(webAppPath);
+            baseDir = artifact;
+            webApp = new File(baseDir + "/src/main/webapp/");
         }
 
-        //appBase
-        String appBase = System.getProperty("user.dir") + File.separator + ".";
-
         Tomcat tomcat = new Tomcat();
-
-        tomcat.setHostname("localhost");
+        //host...
         tomcat.setPort(port);
+        tomcat.getHost().setAppBase(currentPath);
         tomcat.setBaseDir(baseDir);
+        tomcat.addWebapp(currentPath, webApp.getAbsolutePath());
 
-        StandardServer server = (StandardServer) tomcat.getServer();
-        AprLifecycleListener listener = new AprLifecycleListener();
-        server.addLifecycleListener(listener);
-        tomcat.getHost().setAppBase(appBase);
-        tomcat.addWebapp("", webApp.getAbsolutePath());
+        //init param
+        StandardThreadExecutor executor = new StandardThreadExecutor();
+        executor.setMaxThreads(500);
+        //一旦出现问题便于查找问题,设置标识.
+        executor.setNamePrefix("opencron-tomcat-");
 
+        tomcat.getConnector().getService().addExecutor(executor);
+        tomcat.getServer().addLifecycleListener(new LifecycleListener() {
+            @Override
+            public void lifecycleEvent(LifecycleEvent event) {
+                if (event.getLifecycle().equals(Lifecycle.START_EVENT)) {
+                    logger.info("[opencron] TomcatLauncher starting...");
+                }
+                if (event.getLifecycle().equals(Lifecycle.STOP_EVENT)) {
+                    logger.info("[opencron] TomcatLauncher stopping...");
+                }
+            }
+        });
         tomcat.start();
         tomcat.getServer().await();
     }

+ 9 - 5
server.sh

@@ -112,6 +112,12 @@ if [ $? -ne 1 ];then
   exit 1;
 fi
 
+#check openjdk
+if [ "`${RUNJAVA} -version 2>&1 | head -1|grep "openjdk"|wc -l`"x == "1"x ]; then
+  echo_r "ERROR: please uninstall OpenJDK and install jdk first"
+  exit 1;
+fi
+
 # OS specific support.  $var _must_ be set to either true or false.
 cygwin=false
 darwin=false
@@ -169,13 +175,11 @@ fi
 
 [ -d "${DEPLOY_PATH}" ] && rm -rf ${DEPLOY_PATH}/* || mkdir -p ${DEPLOY_PATH}
 
-#将target下的war包解到dist下
+# unpackage war to dist
 cp ${DIST_PATH}/${APP_WAR_NAME} ${DEPLOY_PATH} && cd ${DEPLOY_PATH} && jar xvf ${APP_WAR_NAME} >/dev/null 2>&1 && rm -rf ${DEPLOY_PATH}/${APP_WAR_NAME}
 
-#copy jettyJar
-mkdir ${DEPLOY_PATH}/jetty && cp ${WORKDIR}/${APP_ARTIFACT}/jetty/*.jar ${DEPLOY_PATH}/jetty
-
-mkdir ${DEPLOY_PATH}/tomcat && cp ${WORKDIR}/${APP_ARTIFACT}/tomcat/*.jar ${DEPLOY_PATH}/tomcat
+#copy jars...
+cp -r ${WORKDIR}/${APP_ARTIFACT}/work ${DEPLOY_PATH}
 
 #copy startup.sh
 cp  ${STARTUP_SHELL} ${DEPLOY_PATH}