use of com.alibaba.jstorm.task.Task in project jstorm by alibaba.
the class Worker method createTasks.
private List<TaskShutdownDameon> createTasks() throws Exception {
List<TaskShutdownDameon> shutdownTasks = new ArrayList<>();
Set<Integer> taskIds = workerData.getTaskids();
Set<Thread> threads = new HashSet<>();
List<Task> taskArrayList = new ArrayList<>();
for (int taskId : taskIds) {
Task task = new Task(workerData, taskId);
Thread thread = new Thread(task);
threads.add(thread);
taskArrayList.add(task);
thread.start();
}
for (Thread thread : threads) {
thread.join();
}
for (Task t : taskArrayList) {
shutdownTasks.add(t.getTaskShutdownDameon());
}
return shutdownTasks;
}
Aggregations