Browse Source

[BUG][PeerTaskInstancePriorityQueue]poll implemented in PriorityQueue

pull/3/MERGE
wuxiaofei 4 years ago
parent
commit
5faa5d1703
  1. 17
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/PeerTaskInstancePriorityQueue.java

17
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/PeerTaskInstancePriorityQueue.java

@ -23,6 +23,7 @@ import org.apache.dolphinscheduler.service.exceptions.TaskPriorityQueueException
import java.util.Comparator;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.concurrent.TimeUnit;
/**
* Task instances priority queue implementation
@ -61,6 +62,22 @@ public class PeerTaskInstancePriorityQueue implements TaskPriorityQueue<TaskInst
return queue.poll();
}
/**
* poll task info with timeout
* @param timeout
* @param unit
* @return
* @throws TaskPriorityQueueException
* @throws InterruptedException
*/
@Override
public TaskInstance poll(long timeout, TimeUnit unit) throws TaskPriorityQueueException, InterruptedException {
if (queue.isEmpty()) {
unit.sleep(timeout);
}
return queue.poll();
}
/**
* peek taskInfo
*

Loading…
Cancel
Save