TaskManager任务管理工具类
public class TaskManager {
public static AbstractTask newTask(TaskContext taskInstance)
throws IllegalArgumentException {
switch (taskInstance.getSceneType()) {
case CPU:
return new CpuTask(taskInstance);
case NETWORK:
return new NetworkTask(taskInstance);
case DISK:
return new DiskTask(taskInstance);
case MYSQL:
return new DBTask(taskInstance);
case JVM:
return new JavaTask(taskInstance);
case MEM:
return new MemTask(taskInstance);
case PROCESS:
return new ProcessTask(taskInstance);
case DNS:
return new DnsTask(taskInstance);
default:
throw new IllegalArgumentException("not support task type");
}
}
}