@Test public void test() { TaskCallback callback = new TaskCallback() { @Override public void doNotify(Object notify) { System.err.println(JSON.toJSONString(notify)); } }; List list = new ArrayList(); TaskItem taskItem = new TaskItem("asas") { @Override public BusinessWrapper<String> runTask() { return null; } }; list.add(taskItem); TaskChain taskChain = new TaskChain("initSystem", callback, list); taskChain.doInvoke(); }
public void doInvoke() { if (taskItemList.isEmpty()) { return; } for(TaskItem item : taskItemList) { BusinessWrapper<String> result = item.runTask(); callback.doNotify(result); if (!result.isSuccess()) { logger.warn("run task={} failure, result={}", item.getTaskName(), result.getMsg()); break; } else { logger.info("run task={} success, result={}", item.getTaskName(), result.getBody()); } } }
TaskChain { public void doInvoke() { if (taskItemList.isEmpty()) { return; } for(TaskItem item : taskItemList) { BusinessWrapper<String> result = item.runTask(); callback.doNotify(result); if (!result.isSuccess()) { logger.warn("run task={} failure, result={}", item.getTaskName(), result.getMsg()); break; } else { logger.info("run task={} success, result={}", item.getTaskName(), result.getBody()); } } } }
TaskChain { public void doInvoke() { if (taskItemList.isEmpty()) { return; } for(TaskItem item : taskItemList) { BusinessWrapper<String> result = item.runTask(); callback.doNotify(result); if (!result.isSuccess()) { logger.warn("run task={} failure, result={}", item.getTaskName(), result.getMsg()); break; } else { logger.info("run task={} success, result={}", item.getTaskName(), result.getBody()); } } } TaskChain(String chainName, TaskCallback callback, List<TaskItem> taskItemList); }
TaskChain { public void doInvoke() { if (taskItemList.isEmpty()) { return; } for(TaskItem item : taskItemList) { BusinessWrapper<String> result = item.runTask(); callback.doNotify(result); if (!result.isSuccess()) { logger.warn("run task={} failure, result={}", item.getTaskName(), result.getMsg()); break; } else { logger.info("run task={} success, result={}", item.getTaskName(), result.getBody()); } } } TaskChain(String chainName, TaskCallback callback, List<TaskItem> taskItemList); void doInvoke(); }
TaskChain { public void doInvoke() { if (taskItemList.isEmpty()) { return; } for(TaskItem item : taskItemList) { BusinessWrapper<String> result = item.runTask(); callback.doNotify(result); if (!result.isSuccess()) { logger.warn("run task={} failure, result={}", item.getTaskName(), result.getMsg()); break; } else { logger.info("run task={} success, result={}", item.getTaskName(), result.getBody()); } } } TaskChain(String chainName, TaskCallback callback, List<TaskItem> taskItemList); void doInvoke();  }