diff --git a/lts-example-jobclient/lts-example-jobclient-java/pom.xml b/lts-example-jobclient/lts-example-jobclient-java/pom.xml
new file mode 100644
index 0000000..0d9de20
--- /dev/null
+++ b/lts-example-jobclient/lts-example-jobclient-java/pom.xml
@@ -0,0 +1,14 @@
+
+
+
+ lts-example-jobclient
+ com.github.ltsopensource
+ 1.6.7.1
+
+ 4.0.0
+
+ lts-example-jobclient-java
+
+
\ No newline at end of file
diff --git a/lts-example-jobclient/lts-example-jobclient-java/src/main/java/com/github/ltsopensource/example/java/JobCompletedHandlerImpl.java b/lts-example-jobclient/lts-example-jobclient-java/src/main/java/com/github/ltsopensource/example/java/JobCompletedHandlerImpl.java
new file mode 100644
index 0000000..1632703
--- /dev/null
+++ b/lts-example-jobclient/lts-example-jobclient-java/src/main/java/com/github/ltsopensource/example/java/JobCompletedHandlerImpl.java
@@ -0,0 +1,25 @@
+package com.github.ltsopensource.example.java;
+
+import com.github.ltsopensource.core.commons.utils.CollectionUtils;
+import com.github.ltsopensource.core.domain.JobResult;
+import com.github.ltsopensource.jobclient.support.JobCompletedHandler;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author Robert HG (254963746@qq.com) on 4/17/16.
+ */
+public class JobCompletedHandlerImpl implements JobCompletedHandler {
+
+ @Override
+ public void onComplete(List jobResults) {
+ // 任务执行反馈结果处理
+ if (CollectionUtils.isNotEmpty(jobResults)) {
+ for (JobResult jobResult : jobResults) {
+ System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + " 任务执行完成:" + jobResult);
+ }
+ }
+ }
+}
diff --git a/lts-example-jobclient/lts-example-jobclient-java/src/main/java/com/github/ltsopensource/example/java/Main.java b/lts-example-jobclient/lts-example-jobclient-java/src/main/java/com/github/ltsopensource/example/java/Main.java
new file mode 100644
index 0000000..ab63172
--- /dev/null
+++ b/lts-example-jobclient/lts-example-jobclient-java/src/main/java/com/github/ltsopensource/example/java/Main.java
@@ -0,0 +1,80 @@
+package com.github.ltsopensource.example.java;
+
+import com.github.ltsopensource.core.commons.utils.DateUtils;
+import com.github.ltsopensource.core.domain.Job;
+import com.github.ltsopensource.jobclient.JobClient;
+import com.github.ltsopensource.jobclient.RetryJobClient;
+import com.github.ltsopensource.jobclient.domain.Response;
+
+import java.util.Date;
+
+/**
+ * @author Robert HG (254963746@qq.com) on 4/17/16.
+ */
+public class Main {
+
+ public static void main(String[] args) {
+
+ JobClient jobClient = new RetryJobClient();
+ jobClient.setNodeGroup("test_jobClient");
+ jobClient.setClusterName("test_cluster");
+ jobClient.setRegistryAddress("zookeeper://127.0.0.1:2181");
+ jobClient.setJobCompletedHandler(new JobCompletedHandlerImpl());
+ jobClient.addConfig("job.fail.store", "mapdb");
+ jobClient.start();
+
+ submitCronJob(jobClient);
+ submitRepeatJob(jobClient);
+ submitRealtimeJob(jobClient);
+ submitTriggerTimeJob(jobClient);
+ }
+
+ private static void submitCronJob(JobClient jobClient) {
+ Job job = new Job();
+ job.setTaskId("t_cron_555");
+ job.setParam("shopId", "1122222221");
+ job.setTaskTrackerNodeGroup("test_trade_TaskTracker"); // 执行要执行该任务的taskTracker的节点组名称
+ job.setNeedFeedback(true);
+ job.setReplaceOnExist(true); // 当任务队列中存在这个任务的时候,是否替换更新
+ job.setCronExpression("0 0/1 * * * ?");
+ Response response = jobClient.submitJob(job);
+ System.out.println(response);
+ }
+
+ private static void submitRepeatJob(JobClient jobClient) {
+ Job job = new Job();
+ job.setTaskId("t_repeat_555");
+ job.setParam("shopId", "1122222221");
+ job.setTaskTrackerNodeGroup("test_trade_TaskTracker");
+ job.setNeedFeedback(true);
+ job.setReplaceOnExist(true); // 当任务队列中存在这个任务的时候,是否替换更新
+ job.setRepeatCount(50); // 一共执行50次
+ job.setRepeatInterval(50 * 1000L); // 50s 执行一次
+ Response response = jobClient.submitJob(job);
+ System.out.println(response);
+ }
+
+ private static void submitRealtimeJob(JobClient jobClient) {
+ Job job = new Job();
+ job.setTaskId("t_realtime_555");
+ job.setParam("shopId", "1122222221");
+ job.setTaskTrackerNodeGroup("test_trade_TaskTracker");
+ job.setNeedFeedback(true);
+ job.setReplaceOnExist(true); // 当任务队列中存在这个任务的时候,是否替换更新
+ Response response = jobClient.submitJob(job);
+ System.out.println(response);
+ }
+
+ private static void submitTriggerTimeJob(JobClient jobClient) {
+ Job job = new Job();
+ job.setTaskId("t_trigger_time_555");
+ job.setParam("shopId", "1122222221");
+ job.setTaskTrackerNodeGroup("test_trade_TaskTracker");
+ job.setNeedFeedback(true);
+ job.setReplaceOnExist(true); // 当任务队列中存在这个任务的时候,是否替换更新
+ job.setTriggerTime(DateUtils.addHour(new Date(), 1).getTime()); // 1 小时之后执行
+ Response response = jobClient.submitJob(job);
+ System.out.println(response);
+ }
+
+}
diff --git a/lts-example-jobclient/lts-example-jobclient-java/src/main/java/com/github/ltsopensource/example/java/MasterChangeListenerImpl.java b/lts-example-jobclient/lts-example-jobclient-java/src/main/java/com/github/ltsopensource/example/java/MasterChangeListenerImpl.java
new file mode 100644
index 0000000..6689b77
--- /dev/null
+++ b/lts-example-jobclient/lts-example-jobclient-java/src/main/java/com/github/ltsopensource/example/java/MasterChangeListenerImpl.java
@@ -0,0 +1,7 @@
+package com.github.ltsopensource.example.java;
+
+/**
+ * @author Robert HG (254963746@qq.com) on 4/17/16.
+ */
+public class MasterChangeListenerImpl {
+}
diff --git a/lts-example-jobclient/lts-example-jobclient-java/src/main/resources/log4j.properties b/lts-example-jobclient/lts-example-jobclient-java/src/main/resources/log4j.properties
new file mode 100644
index 0000000..4e3c103
--- /dev/null
+++ b/lts-example-jobclient/lts-example-jobclient-java/src/main/resources/log4j.properties
@@ -0,0 +1,7 @@
+
+log4j.rootLogger=INFO,stdout
+
+log4j.appender.stdout.Threshold=INFO
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%-5p] [%d{HH:mm:ss}] %c - %m%n
\ No newline at end of file
diff --git a/lts-example-jobclient/lts-example-jobclient-spring/pom.xml b/lts-example-jobclient/lts-example-jobclient-spring/pom.xml
new file mode 100644
index 0000000..0cdb253
--- /dev/null
+++ b/lts-example-jobclient/lts-example-jobclient-spring/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ lts-example-jobclient
+ com.github.ltsopensource
+ 1.6.7.1
+
+ 4.0.0
+
+ lts-example-jobclient-spring
+
+
+
\ No newline at end of file
diff --git a/lts-example-jobclient/pom.xml b/lts-example-jobclient/pom.xml
index b5a8294..f41e5d9 100644
--- a/lts-example-jobclient/pom.xml
+++ b/lts-example-jobclient/pom.xml
@@ -11,6 +11,8 @@
pom
lts-example-jobclient-springboot
+ lts-example-jobclient-spring
+ lts-example-jobclient-java
lts-example-jobclient
diff --git a/lts-example-jobtracker/lts-example-jobtracker-java/pom.xml b/lts-example-jobtracker/lts-example-jobtracker-java/pom.xml
new file mode 100644
index 0000000..8656415
--- /dev/null
+++ b/lts-example-jobtracker/lts-example-jobtracker-java/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ lts-example-jobtracker
+ com.github.ltsopensource
+ 1.6.7.1
+
+ 4.0.0
+
+ lts-example-jobtracker-java
+
+
+
\ No newline at end of file
diff --git a/lts-example-jobtracker/lts-example-jobtracker-java/src/main/java/com/github/ltsopensource/example/java/Main.java b/lts-example-jobtracker/lts-example-jobtracker-java/src/main/java/com/github/ltsopensource/example/java/Main.java
new file mode 100644
index 0000000..bb2bee8
--- /dev/null
+++ b/lts-example-jobtracker/lts-example-jobtracker-java/src/main/java/com/github/ltsopensource/example/java/Main.java
@@ -0,0 +1,37 @@
+package com.github.ltsopensource.example.java;
+
+import com.github.ltsopensource.jobtracker.JobTracker;
+
+/**
+ * @author Robert HG (254963746@qq.com) on 4/17/16.
+ */
+public class Main {
+
+ public static void main(String[] args) {
+ final JobTracker jobTracker = new JobTracker();
+ // 节点信息配置
+ jobTracker.setRegistryAddress("zookeeper://127.0.0.1:2181");
+// jobTracker.setRegistryAddress("redis://127.0.0.1:6379");
+ jobTracker.setListenPort(35001); // 默认 35001
+ jobTracker.setClusterName("test_cluster");
+
+// // 设置业务日志记录 mysql
+// jobTracker.addConfig("job.logger", "mysql");
+// // 任务队列用mysql
+// jobTracker.addConfig("job.queue", "mysql");
+ // mysql 配置
+ jobTracker.addConfig("jdbc.url", "jdbc:mysql://127.0.0.1:3306/lts");
+ jobTracker.addConfig("jdbc.username", "root");
+ jobTracker.addConfig("jdbc.password", "root");
+ // 启动节点
+ jobTracker.start();
+
+ Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+ @Override
+ public void run() {
+ jobTracker.stop();
+ }
+ }));
+ }
+
+}
diff --git a/lts-example-jobtracker/lts-example-jobtracker-java/src/main/resources/log4j.properties b/lts-example-jobtracker/lts-example-jobtracker-java/src/main/resources/log4j.properties
new file mode 100644
index 0000000..4e3c103
--- /dev/null
+++ b/lts-example-jobtracker/lts-example-jobtracker-java/src/main/resources/log4j.properties
@@ -0,0 +1,7 @@
+
+log4j.rootLogger=INFO,stdout
+
+log4j.appender.stdout.Threshold=INFO
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%-5p] [%d{HH:mm:ss}] %c - %m%n
\ No newline at end of file
diff --git a/lts-example-jobtracker/lts-example-jobtracker-spring/pom.xml b/lts-example-jobtracker/lts-example-jobtracker-spring/pom.xml
new file mode 100644
index 0000000..5109199
--- /dev/null
+++ b/lts-example-jobtracker/lts-example-jobtracker-spring/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ lts-example-jobtracker
+ com.github.ltsopensource
+ 1.6.7.1
+
+ 4.0.0
+
+ lts-example-jobtracker-spring
+
+
+
\ No newline at end of file
diff --git a/lts-example-jobtracker/pom.xml b/lts-example-jobtracker/pom.xml
index b7fae95..ccb7280 100644
--- a/lts-example-jobtracker/pom.xml
+++ b/lts-example-jobtracker/pom.xml
@@ -12,6 +12,8 @@
pom
lts-example-jobtracker-springboot
+ lts-example-jobtracker-java
+ lts-example-jobtracker-spring
diff --git a/lts-example-tasktracker/lts-example-tasktracker-java/pom.xml b/lts-example-tasktracker/lts-example-tasktracker-java/pom.xml
new file mode 100644
index 0000000..fcb8a2a
--- /dev/null
+++ b/lts-example-tasktracker/lts-example-tasktracker-java/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ lts-example-tasktracker
+ com.github.ltsopensource
+ 1.6.7.1
+
+ 4.0.0
+
+ lts-example-tasktracker-java
+
+
+
\ No newline at end of file
diff --git a/lts-example-tasktracker/lts-example-tasktracker-java/src/main/java/com/github/ltsopensource/example/java/Main.java b/lts-example-tasktracker/lts-example-tasktracker-java/src/main/java/com/github/ltsopensource/example/java/Main.java
new file mode 100644
index 0000000..1376241
--- /dev/null
+++ b/lts-example-tasktracker/lts-example-tasktracker-java/src/main/java/com/github/ltsopensource/example/java/Main.java
@@ -0,0 +1,29 @@
+package com.github.ltsopensource.example.java;
+
+import com.github.ltsopensource.tasktracker.TaskTracker;
+
+/**
+ * @author Robert HG (254963746@qq.com) on 4/17/16.
+ */
+public class Main {
+
+ public static void main(String[] args) {
+
+ final TaskTracker taskTracker = new TaskTracker();
+ // 任务执行类,实现JobRunner 接口
+ taskTracker.setJobRunnerClass(TestJobRunner.class);
+ taskTracker.setRegistryAddress("zookeeper://127.0.0.1:2181");
+ taskTracker.setNodeGroup("test_trade_TaskTracker"); // 同一个TaskTracker集群这个名字相同
+ taskTracker.setClusterName("test_cluster");
+ taskTracker.setWorkThreads(64);
+ taskTracker.addConfig("job.fail.store", "mapdb");
+ taskTracker.start();
+
+ Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+ @Override
+ public void run() {
+ taskTracker.stop();
+ }
+ }));
+ }
+}
diff --git a/lts-example-tasktracker/lts-example-tasktracker-java/src/main/java/com/github/ltsopensource/example/java/TestJobRunner.java b/lts-example-tasktracker/lts-example-tasktracker-java/src/main/java/com/github/ltsopensource/example/java/TestJobRunner.java
new file mode 100644
index 0000000..53be7de
--- /dev/null
+++ b/lts-example-tasktracker/lts-example-tasktracker-java/src/main/java/com/github/ltsopensource/example/java/TestJobRunner.java
@@ -0,0 +1,35 @@
+package com.github.ltsopensource.example.java;
+
+import com.github.ltsopensource.core.domain.Action;
+import com.github.ltsopensource.core.logger.Logger;
+import com.github.ltsopensource.core.logger.LoggerFactory;
+import com.github.ltsopensource.tasktracker.Result;
+import com.github.ltsopensource.tasktracker.logger.BizLogger;
+import com.github.ltsopensource.tasktracker.runner.JobContext;
+import com.github.ltsopensource.tasktracker.runner.JobRunner;
+
+/**
+ * @author Robert HG (254963746@qq.com) on 4/17/16.
+ */
+public class TestJobRunner implements JobRunner {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestJobRunner.class);
+
+ @Override
+ public Result run(JobContext jobContext) throws Throwable {
+ try {
+// BizLogger bizLogger = LtsLoggerFactory.getBizLogger();
+ BizLogger bizLogger = jobContext.getBizLogger();
+
+ // TODO 业务逻辑
+ LOGGER.info("我要执行:" + jobContext);
+ // 会发送到 LTS (JobTracker上)
+ bizLogger.info("测试,业务日志啊啊啊啊啊");
+
+ } catch (Exception e) {
+ LOGGER.info("Run job failed!", e);
+ return new Result(Action.EXECUTE_FAILED, e.getMessage());
+ }
+ return new Result(Action.EXECUTE_SUCCESS, "执行成功了,哈哈");
+ }
+}
diff --git a/lts-example-tasktracker/lts-example-tasktracker-java/src/main/resources/log4j.properties b/lts-example-tasktracker/lts-example-tasktracker-java/src/main/resources/log4j.properties
new file mode 100644
index 0000000..4e3c103
--- /dev/null
+++ b/lts-example-tasktracker/lts-example-tasktracker-java/src/main/resources/log4j.properties
@@ -0,0 +1,7 @@
+
+log4j.rootLogger=INFO,stdout
+
+log4j.appender.stdout.Threshold=INFO
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%-5p] [%d{HH:mm:ss}] %c - %m%n
\ No newline at end of file
diff --git a/lts-example-tasktracker/pom.xml b/lts-example-tasktracker/pom.xml
index 370c146..3dfe169 100644
--- a/lts-example-tasktracker/pom.xml
+++ b/lts-example-tasktracker/pom.xml
@@ -11,6 +11,7 @@
pom
lts-example-tasktarcker-springboot
+ lts-example-tasktracker-java
lts-example-tasktracker