Browse Source

update poll task

pull/2/head
lenboo 5 years ago
parent
commit
94a37429e0
  1. 11
      escheduler-common/src/main/java/cn/escheduler/common/queue/TaskQueueZkImpl.java

11
escheduler-common/src/main/java/cn/escheduler/common/queue/TaskQueueZkImpl.java

@ -228,11 +228,11 @@ public class TaskQueueZkImpl extends AbstractZKClient implements ITaskQueue {
int j = 0; int j = 0;
List<String> taskslist = new ArrayList<>(tasksNum); List<String> taskslist = new ArrayList<>(tasksNum);
while(iterator.hasNext()){ while(iterator.hasNext()){
if(j++ < tasksNum){ if(j++ >= tasksNum){
String task = iterator.next(); break;
taskslist.add(getOriginTaskFormat(task));
} }
String task = iterator.next();
taskslist.add(getOriginTaskFormat(task));
} }
return taskslist; return taskslist;
} }
@ -245,6 +245,9 @@ public class TaskQueueZkImpl extends AbstractZKClient implements ITaskQueue {
*/ */
private String getOriginTaskFormat(String formatTask){ private String getOriginTaskFormat(String formatTask){
String[] taskArray = formatTask.split(Constants.UNDERLINE); String[] taskArray = formatTask.split(Constants.UNDERLINE);
if(taskArray.length< 4){
return formatTask;
}
int processInstanceId = Integer.parseInt(taskArray[1]); int processInstanceId = Integer.parseInt(taskArray[1]);
int taskId = Integer.parseInt(taskArray[3]); int taskId = Integer.parseInt(taskArray[3]);

Loading…
Cancel
Save