hugui 9 년 전
부모
커밋
dc195378d7

+ 0 - 0
doc/LTS 使用说明文档.pdf → docs/LTS 使用说明文档.pdf


+ 0 - 0
doc/LTS_Admin.png → docs/LTS_Admin.png


+ 0 - 0
doc/LTS_architecture.png → docs/LTS_architecture.png


+ 0 - 0
doc/LTS_progress.png → docs/LTS_progress.png


BIN
docs/LTS一个TaskTracker执行多种任务.pdf


BIN
docs/LTS业务场景说明.pdf


+ 4 - 7
lts-core/src/main/java/com/lts/remoting/netty/NettyRemotingServer.java

@@ -251,8 +251,7 @@ public class NettyRemotingServer extends NettyRemotingAbstract implements Remoti
             super.channelActive(ctx);
 
             if (NettyRemotingServer.this.channelEventListener != null) {
-                NettyRemotingServer.this.putNettyEvent(new NettyEvent(NettyEventType.CONNECT, remoteAddress
-                        .toString(), ctx.channel()));
+                NettyRemotingServer.this.putNettyEvent(new NettyEvent(NettyEventType.CONNECT, remoteAddress, ctx.channel()));
             }
         }
 
@@ -263,8 +262,7 @@ public class NettyRemotingServer extends NettyRemotingAbstract implements Remoti
             super.channelInactive(ctx);
 
             if (NettyRemotingServer.this.channelEventListener != null) {
-                NettyRemotingServer.this.putNettyEvent(new NettyEvent(NettyEventType.CLOSE, remoteAddress
-                        .toString(), ctx.channel()));
+                NettyRemotingServer.this.putNettyEvent(new NettyEvent(NettyEventType.CLOSE, remoteAddress, ctx.channel()));
             }
         }
 
@@ -284,7 +282,7 @@ public class NettyRemotingServer extends NettyRemotingAbstract implements Remoti
                 if (NettyRemotingServer.this.channelEventListener != null) {
                     NettyEventType nettyEventType = NettyEventType.valueOf(event.state().name());
                     NettyRemotingServer.this.putNettyEvent(new NettyEvent(nettyEventType,
-                            remoteAddress.toString(), ctx.channel()));
+                            remoteAddress, ctx.channel()));
                 }
             }
 
@@ -299,8 +297,7 @@ public class NettyRemotingServer extends NettyRemotingAbstract implements Remoti
             log.warn("NETTY SERVER PIPELINE: exceptionCaught exception.", cause);
 
             if (NettyRemotingServer.this.channelEventListener != null) {
-                NettyRemotingServer.this.putNettyEvent(new NettyEvent(NettyEventType.EXCEPTION, remoteAddress
-                        .toString(), ctx.channel()));
+                NettyRemotingServer.this.putNettyEvent(new NettyEvent(NettyEventType.EXCEPTION, remoteAddress, ctx.channel()));
             }
 
             RemotingUtil.closeChannel(ctx.channel());

+ 45 - 0
lts-example/src/main/java/com/lts/example/support/JobRunnerDispatcher.java

@@ -0,0 +1,45 @@
+package com.lts.example.support;
+
+import com.lts.core.domain.Job;
+import com.lts.tasktracker.Result;
+import com.lts.tasktracker.runner.JobRunner;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 总入口,在 taskTracker.setJobRunnerClass(JobRunnerDispatcher.class)
+ * JobClient 提交 任务时指定 Job 类型  job.setParam("type", "aType")
+ * @author Robert HG (254963746@qq.com) on 8/19/14.
+ */
+public class JobRunnerDispatcher implements JobRunner {
+
+    private static final ConcurrentHashMap<String/*type*/, JobRunner>
+            JOB_RUNNER_MAP = new ConcurrentHashMap<String, JobRunner>();
+
+    static {
+        JOB_RUNNER_MAP.put("aType", new JobRunnerA()); // 也可以从Spring中拿
+        JOB_RUNNER_MAP.put("bType", new JobRunnerB());
+    }
+
+    @Override
+    public Result run(Job job) throws Throwable {
+        String type = job.getParam("type");
+        return JOB_RUNNER_MAP.get(type).run(job);
+    }
+}
+
+class JobRunnerA implements JobRunner {
+    @Override
+    public Result run(Job job) throws Throwable {
+        //  TODO A类型Job的逻辑
+        return null;
+    }
+}
+
+class JobRunnerB implements JobRunner {
+    @Override
+    public Result run(Job job) throws Throwable {
+        // TODO B类型Job的逻辑
+        return null;
+    }
+}

+ 0 - 1
lts-example/src/main/java/com/lts/example/support/MemoryStatus.java

@@ -10,7 +10,6 @@ public class MemoryStatus {
         long freeMemory = runtime.freeMemory();
         long totalMemory = runtime.totalMemory();
         long maxMemory = runtime.maxMemory();
-        boolean ok = (maxMemory - (totalMemory - freeMemory) > 2048); // 剩余空间小于2M报警
         String msg = "Max:" + (maxMemory / 1024 / 1024) + "M, Total:"
                 + (totalMemory / 1024 / 1024) + "M, Free:" + (freeMemory / 1024 / 1024)
                 + "M, Use:" + ((totalMemory / 1024 / 1024) - (freeMemory / 1024 / 1024)) + "M";

+ 1 - 1
lts-example/src/main/java/com/lts/example/support/NoopJobRunner.java

@@ -13,7 +13,7 @@ import java.util.concurrent.atomic.AtomicInteger;
  */
 public class NoopJobRunner implements JobRunner {
 
-    static long start = 0;
+    static volatile long start = 0;
     static AtomicInteger num = new AtomicInteger(0);
 
     public NoopJobRunner() {

+ 0 - 22
lts-file-system/pom.xml

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>lts-parent</artifactId>
-        <groupId>com.lts</groupId>
-        <version>1.5.4-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>lts-file-system</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.lts</groupId>
-            <artifactId>lts-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-
-</project>

+ 0 - 1
pom.xml

@@ -18,7 +18,6 @@
         <module>lts-example</module>
         <module>lts-admin</module>
         <module>lts-spring</module>
-        <!--<module>lts-file-system</module>-->
     </modules>
 
     <properties>