Loading escheduler-alert/pom.xml +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ <parent> <groupId>cn.analysys</groupId> <artifactId>escheduler</artifactId> <version>1.0.4-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version> </parent> <artifactId>escheduler-alert</artifactId> <packaging>jar</packaging> Loading escheduler-api/pom.xml +6 −3 Original line number Diff line number Diff line <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"> <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"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>cn.analysys</groupId> <artifactId>escheduler</artifactId> <version>1.0.4-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version> </parent> <artifactId>escheduler-api</artifactId> <packaging>jar</packaging> Loading Loading @@ -48,6 +47,10 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> <exclusion> <artifactId>log4j-to-slf4j</artifactId> <groupId>org.apache.logging.log4j</groupId> </exclusion> </exclusions> </dependency> Loading escheduler-common/pom.xml +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ <parent> <artifactId>escheduler</artifactId> <groupId>cn.analysys</groupId> <version>1.0.4-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version> </parent> <artifactId>escheduler-common</artifactId> <name>escheduler-common</name> Loading escheduler-common/src/main/java/cn/escheduler/common/queue/TaskQueueZkImpl.java +23 −3 Original line number Diff line number Diff line Loading @@ -151,7 +151,27 @@ public class TaskQueueZkImpl extends AbstractZKClient implements ITaskQueue { int size = list.size(); Set<String> taskTreeSet = new TreeSet<>(); Set<String> taskTreeSet = new TreeSet<>(new Comparator<String>() { @Override public int compare(String o1, String o2) { String s1 = o1; String s2 = o2; String[] s1Array = s1.split(Constants.UNDERLINE); if(s1Array.length>4){ // warning: if this length > 5, need to be changed s1 = s1.substring(0, s1.lastIndexOf(Constants.UNDERLINE) ); } String[] s2Array = s2.split(Constants.UNDERLINE); if(s2Array.length>4){ // warning: if this length > 5, need to be changed s2 = s2.substring(0, s2.lastIndexOf(Constants.UNDERLINE) ); } return s1.compareTo(s2); } }); for (int i = 0; i < size; i++) { Loading @@ -173,8 +193,8 @@ public class TaskQueueZkImpl extends AbstractZKClient implements ITaskQueue { continue; } } formatTask += Constants.UNDERLINE + taskDetailArrs[4]; } taskTreeSet.add(formatTask); } Loading Loading @@ -229,7 +249,7 @@ public class TaskQueueZkImpl extends AbstractZKClient implements ITaskQueue { int taskId = Integer.parseInt(taskArray[3]); StringBuilder sb = new StringBuilder(50); String destTask = String.format("%s_%s_%s_%s", taskArray[0], processInstanceId, taskArray[3], taskId); String destTask = String.format("%s_%s_%s_%s", taskArray[0], processInstanceId, taskArray[2], taskId); sb.append(destTask); Loading escheduler-common/src/test/java/cn/escheduler/common/queue/TaskQueueImplTest.java +8 −6 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package cn.escheduler.common.queue; import cn.escheduler.common.Constants; import cn.escheduler.common.utils.IpUtils; import cn.escheduler.common.utils.OSUtils; import org.junit.After; import org.junit.Assert; import org.junit.Before; Loading Loading @@ -58,31 +60,31 @@ public class TaskQueueImplTest { @Test public void testAdd(){ //add tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"1_1_1_1_2130706433,3232236775"); tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"1_0_1_1_-1"); tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"0_1_1_1_2130706433,3232236775"); tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"1_1_0_1_2130706433,3232236775"); tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"1_1_0_1_2130706433,3232236775,"+IpUtils.ipToLong(OSUtils.getHost())); tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"1_2_1_1_2130706433,3232236775"); List<String> tasks = tasksQueue.poll(Constants.SCHEDULER_TASKS_QUEUE, 1); if(tasks.size() < 0){ if(tasks.size() <= 0){ return; } //pop String node1 = tasks.get(0); assertEquals(node1,"0_0000000001_1_0000000001"); assertEquals(node1,"1_0_1_1_-1"); tasks = tasksQueue.poll(Constants.SCHEDULER_TASKS_QUEUE, 1); if(tasks.size() < 0){ if(tasks.size() <= 0){ return; } String node2 = tasks.get(0); assertEquals(node2,"0_0000000001_1_0000000001"); } Loading Loading
escheduler-alert/pom.xml +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ <parent> <groupId>cn.analysys</groupId> <artifactId>escheduler</artifactId> <version>1.0.4-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version> </parent> <artifactId>escheduler-alert</artifactId> <packaging>jar</packaging> Loading
escheduler-api/pom.xml +6 −3 Original line number Diff line number Diff line <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"> <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"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>cn.analysys</groupId> <artifactId>escheduler</artifactId> <version>1.0.4-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version> </parent> <artifactId>escheduler-api</artifactId> <packaging>jar</packaging> Loading Loading @@ -48,6 +47,10 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> <exclusion> <artifactId>log4j-to-slf4j</artifactId> <groupId>org.apache.logging.log4j</groupId> </exclusion> </exclusions> </dependency> Loading
escheduler-common/pom.xml +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ <parent> <artifactId>escheduler</artifactId> <groupId>cn.analysys</groupId> <version>1.0.4-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version> </parent> <artifactId>escheduler-common</artifactId> <name>escheduler-common</name> Loading
escheduler-common/src/main/java/cn/escheduler/common/queue/TaskQueueZkImpl.java +23 −3 Original line number Diff line number Diff line Loading @@ -151,7 +151,27 @@ public class TaskQueueZkImpl extends AbstractZKClient implements ITaskQueue { int size = list.size(); Set<String> taskTreeSet = new TreeSet<>(); Set<String> taskTreeSet = new TreeSet<>(new Comparator<String>() { @Override public int compare(String o1, String o2) { String s1 = o1; String s2 = o2; String[] s1Array = s1.split(Constants.UNDERLINE); if(s1Array.length>4){ // warning: if this length > 5, need to be changed s1 = s1.substring(0, s1.lastIndexOf(Constants.UNDERLINE) ); } String[] s2Array = s2.split(Constants.UNDERLINE); if(s2Array.length>4){ // warning: if this length > 5, need to be changed s2 = s2.substring(0, s2.lastIndexOf(Constants.UNDERLINE) ); } return s1.compareTo(s2); } }); for (int i = 0; i < size; i++) { Loading @@ -173,8 +193,8 @@ public class TaskQueueZkImpl extends AbstractZKClient implements ITaskQueue { continue; } } formatTask += Constants.UNDERLINE + taskDetailArrs[4]; } taskTreeSet.add(formatTask); } Loading Loading @@ -229,7 +249,7 @@ public class TaskQueueZkImpl extends AbstractZKClient implements ITaskQueue { int taskId = Integer.parseInt(taskArray[3]); StringBuilder sb = new StringBuilder(50); String destTask = String.format("%s_%s_%s_%s", taskArray[0], processInstanceId, taskArray[3], taskId); String destTask = String.format("%s_%s_%s_%s", taskArray[0], processInstanceId, taskArray[2], taskId); sb.append(destTask); Loading
escheduler-common/src/test/java/cn/escheduler/common/queue/TaskQueueImplTest.java +8 −6 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package cn.escheduler.common.queue; import cn.escheduler.common.Constants; import cn.escheduler.common.utils.IpUtils; import cn.escheduler.common.utils.OSUtils; import org.junit.After; import org.junit.Assert; import org.junit.Before; Loading Loading @@ -58,31 +60,31 @@ public class TaskQueueImplTest { @Test public void testAdd(){ //add tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"1_1_1_1_2130706433,3232236775"); tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"1_0_1_1_-1"); tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"0_1_1_1_2130706433,3232236775"); tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"1_1_0_1_2130706433,3232236775"); tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"1_1_0_1_2130706433,3232236775,"+IpUtils.ipToLong(OSUtils.getHost())); tasksQueue.add(Constants.SCHEDULER_TASKS_QUEUE,"1_2_1_1_2130706433,3232236775"); List<String> tasks = tasksQueue.poll(Constants.SCHEDULER_TASKS_QUEUE, 1); if(tasks.size() < 0){ if(tasks.size() <= 0){ return; } //pop String node1 = tasks.get(0); assertEquals(node1,"0_0000000001_1_0000000001"); assertEquals(node1,"1_0_1_1_-1"); tasks = tasksQueue.poll(Constants.SCHEDULER_TASKS_QUEUE, 1); if(tasks.size() < 0){ if(tasks.size() <= 0){ return; } String node2 = tasks.get(0); assertEquals(node2,"0_0000000001_1_0000000001"); } Loading