use of com.bonree.brfs.schedulers.task.model.TaskModel in project BRFS by zhangnianli.
the class DefaultReleaseTask method queryTaskState.
@Override
public int queryTaskState(String taskName, String taskType) {
try {
if (BrStringUtils.isEmpty(taskName)) {
return -1;
}
if (BrStringUtils.isEmpty(taskType)) {
return -2;
}
StringBuilder taskPath = new StringBuilder();
taskPath.append(this.taskQueue).append("/").append(taskType).append("/").append(taskName);
String path = taskPath.toString();
if (!client.checkExists(path)) {
return -3;
}
byte[] data = client.getData(path);
if (data == null || data.length == 0) {
return -4;
}
TaskModel tmp = JsonUtils.toObject(data, TaskModel.class);
return tmp.getTaskState();
} catch (Exception e) {
LOG.error("query task status error {}", e);
}
return -5;
}
Aggregations