Преглед на файлове

1.7.1-SNAPSHOT 增加 jdbc.create.db.table(boolean)来决定是否需要创建数据库表

hugui преди 8 години
родител
ревизия
99b4746b56

+ 2 - 3
README.md

@@ -17,9 +17,8 @@ oschina地址:
 
 这两个地址都会同步更新。感兴趣,请加QQ群:109500214 一起探讨、完善。越多人支持,就越有动力去更新,喜欢记得右上角star哈。
 
-##1.7.0(master)变更主要点
-1. 增加手动触发任务按钮
-2. 优化PreLoader
+##1.7.1-SNAPSHOT(master)变更主要点
+1. 增加节点上线下线功能
 
 ## 框架概况
 LTS 有主要有以下四种节点:

+ 1 - 1
build.cmd

@@ -4,7 +4,7 @@ start mvn clean install -DskipTests
 echo "LTS: mvn clean install -DskipTests"
 echo "LTS: After sub window finished, close it , and press any key to continue" & pause>nul
 
-set VERSION=1.7.0
+set VERSION=1.7.1-SNAPSHOT
 set BASE_HOME=%~dp0%
 set DIST_BIN_DIR=lts-%VERSION%-bin
 

+ 1 - 1
build.sh

@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-VERSION="1.7.0"
+VERSION="1.7.1-SNAPSHOT"
 
 LTS_BIN="${BASH_SOURCE-$0}"
 LTS_BIN="$(dirname "${LTS_BIN}")"

+ 1 - 1
lts-admin/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>lts-parent</artifactId>
         <groupId>com.github.ltsopensource</groupId>
-        <version>1.7.0</version>
+        <version>1.7.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>war</packaging>

+ 1 - 1
lts-core/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>lts-parent</artifactId>
         <groupId>com.github.ltsopensource</groupId>
-        <version>1.7.0</version>
+        <version>1.7.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>jar</packaging>

+ 2 - 0
lts-core/src/main/java/com/github/ltsopensource/core/cmd/HttpCmdNames.java

@@ -19,4 +19,6 @@ public interface HttpCmdNames {
 
     String HTTP_CMD_JOB_TERMINATE = "job_terminate_cmd";
 
+    String HTTP_CMD_NODE_ONLINE_OFFLINE = "node_online_offline_cmd";
+
 }

+ 2 - 0
lts-core/src/main/java/com/github/ltsopensource/core/constant/ExtConfig.java

@@ -80,6 +80,8 @@ public interface ExtConfig {
     String JDBC_URL = "jdbc.url";
     String JDBC_USERNAME = "jdbc.username";
     String JDBC_PASSWORD = "jdbc.password";
+
+    String NEED_CREATE_DB_TABLE = "jdbc.create.db.table";
     /**
      * Durid相关数据的配置
      */

+ 12 - 2
lts-core/src/main/java/com/github/ltsopensource/core/monitor/AbstractMStatReporter.java

@@ -3,11 +3,13 @@ package com.github.ltsopensource.core.monitor;
 import com.github.ltsopensource.core.AppContext;
 import com.github.ltsopensource.core.cluster.Config;
 import com.github.ltsopensource.core.cluster.NodeType;
+import com.github.ltsopensource.core.commons.utils.Callable;
 import com.github.ltsopensource.core.constant.ExtConfig;
 import com.github.ltsopensource.core.domain.monitor.MData;
 import com.github.ltsopensource.core.factory.NamedThreadFactory;
 import com.github.ltsopensource.core.logger.Logger;
 import com.github.ltsopensource.core.logger.LoggerFactory;
+import com.github.ltsopensource.core.support.NodeShutdownHook;
 import com.github.ltsopensource.jvmmonitor.JVMMonitor;
 
 import java.util.concurrent.Executors;
@@ -41,17 +43,25 @@ public abstract class AbstractMStatReporter implements MStatReporter {
         // 启动JVM监控
         JVMMonitor.start();
 
+        final MStatReportWorker worker = new MStatReportWorker(appContext, this);
+
         try {
             if (!config.getParameter(ExtConfig.M_STAT_REPORTER_CLOSED, false)) {
                 if (start.compareAndSet(false, true)) {
-                    scheduledFuture = executor.scheduleWithFixedDelay(
-                            new MStatReportWorker(appContext, this), 1, 1, TimeUnit.SECONDS);
+                    scheduledFuture = executor.scheduleWithFixedDelay(worker, 1, 1, TimeUnit.SECONDS);
                     LOGGER.info("MStatReporter start succeed.");
                 }
             }
         } catch (Exception e) {
             LOGGER.error("MStatReporter start failed.", e);
         }
+
+        NodeShutdownHook.registerHook(appContext, this.getClass().getName(), new Callable() {
+            @Override
+            public void call() throws Exception {
+                worker.run();
+            }
+        });
     }
 
     /**

+ 1 - 1
lts-core/src/main/java/com/github/ltsopensource/core/support/Version.java

@@ -20,7 +20,7 @@ public final class Version {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(Version.class);
 
-    private static final String VERSION = getVersion(Version.class, "1.7.0");
+    private static final String VERSION = getVersion(Version.class, "1.7.1-SNAPSHOT");
 
     static {
         // 检查是否存在重复的jar包

+ 9 - 4
lts-core/src/main/java/com/github/ltsopensource/store/jdbc/JdbcAbstractAccess.java

@@ -3,6 +3,7 @@ package com.github.ltsopensource.store.jdbc;
 import com.github.ltsopensource.core.cluster.Config;
 import com.github.ltsopensource.core.commons.file.FileUtils;
 import com.github.ltsopensource.core.constant.Constants;
+import com.github.ltsopensource.core.constant.ExtConfig;
 import com.github.ltsopensource.core.exception.LtsRuntimeException;
 import com.github.ltsopensource.store.jdbc.exception.JdbcException;
 
@@ -15,8 +16,10 @@ import java.io.InputStream;
 public abstract class JdbcAbstractAccess {
 
     private SqlTemplate sqlTemplate;
+    private Config config;
 
     public JdbcAbstractAccess(Config config) {
+        this.config = config;
         this.sqlTemplate = SqlTemplateFactory.create(config);
     }
 
@@ -39,10 +42,12 @@ public abstract class JdbcAbstractAccess {
     }
 
     protected void createTable(String sql) throws JdbcException {
-        try {
-            getSqlTemplate().createTable(sql);
-        } catch (Exception e) {
-            throw new JdbcException("Create table error, sql=" + sql, e);
+        if (config.getParameter(ExtConfig.NEED_CREATE_DB_TABLE, true)) {
+            try {
+                getSqlTemplate().createTable(sql);
+            } catch (Exception e) {
+                throw new JdbcException("Create table error, sql=" + sql, e);
+            }
         }
     }
 }

+ 1 - 1
lts-jobclient/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>lts-parent</artifactId>
         <groupId>com.github.ltsopensource</groupId>
-        <version>1.7.0</version>
+        <version>1.7.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
lts-jobtracker/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>lts-parent</artifactId>
         <groupId>com.github.ltsopensource</groupId>
-        <version>1.7.0</version>
+        <version>1.7.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
lts-monitor/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>lts-parent</artifactId>
         <groupId>com.github.ltsopensource</groupId>
-        <version>1.7.0</version>
+        <version>1.7.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
lts-spring/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>lts-parent</artifactId>
         <groupId>com.github.ltsopensource</groupId>
-        <version>1.7.0</version>
+        <version>1.7.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>jar</packaging>

+ 1 - 1
lts-startup/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>lts-parent</artifactId>
         <groupId>com.github.ltsopensource</groupId>
-        <version>1.7.0</version>
+        <version>1.7.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>jar</packaging>

+ 1 - 1
lts-tasktracker/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>lts-parent</artifactId>
         <groupId>com.github.ltsopensource</groupId>
-        <version>1.7.0</version>
+        <version>1.7.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 38 - 0
lts-tasktracker/src/main/java/com/github/ltsopensource/tasktracker/cmd/NodeOnlineOfflineCmd.java

@@ -0,0 +1,38 @@
+package com.github.ltsopensource.tasktracker.cmd;
+
+import com.github.ltsopensource.cmd.HttpCmdProc;
+import com.github.ltsopensource.cmd.HttpCmdRequest;
+import com.github.ltsopensource.cmd.HttpCmdResponse;
+import com.github.ltsopensource.core.cmd.HttpCmdNames;
+import com.github.ltsopensource.tasktracker.domain.TaskTrackerAppContext;
+
+/**
+ * 节点上下线
+ *
+ * @author Robert HG (254963746@qq.com) on 29/03/2017.
+ */
+public class NodeOnlineOfflineCmd implements HttpCmdProc {
+
+    private TaskTrackerAppContext appContext;
+
+    public NodeOnlineOfflineCmd(TaskTrackerAppContext appContext) {
+        this.appContext = appContext;
+    }
+
+    @Override
+    public String nodeIdentity() {
+        return appContext.getConfig().getIdentity();
+    }
+
+    @Override
+    public String getCommand() {
+        return HttpCmdNames.HTTP_CMD_NODE_ONLINE_OFFLINE;
+    }
+
+    @Override
+    public HttpCmdResponse execute(HttpCmdRequest request) throws Exception {
+
+
+        return null;
+    }
+}

+ 1 - 1
lts/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>lts-parent</artifactId>
         <groupId>com.github.ltsopensource</groupId>
-        <version>1.7.0</version>
+        <version>1.7.1-SNAPSHOT</version>
     </parent>
     <packaging>jar</packaging>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
pom.xml

@@ -13,7 +13,7 @@
     <groupId>com.github.ltsopensource</groupId>
     <artifactId>lts-parent</artifactId>
     <packaging>pom</packaging>
-    <version>1.7.0</version>
+    <version>1.7.1-SNAPSHOT</version>
     <url>https://github.com/ltsopensource/light-task-scheduler.git</url>
     <modules>
         <module>lts-core</module>