no message

This commit is contained in:
2024-10-09 22:21:57 +03:00
parent 54c80c516b
commit 6252af944e
699 changed files with 2634 additions and 1997 deletions

View File

@@ -0,0 +1,16 @@
package _VisualDVM.GlobalData.Tasks.QueueSystem;
import _VisualDVM.GlobalData.Tasks.TaskState;
public class MVS extends QueueSystem {
public MVS() {
cancel_command = "mcancel";
check_command = "mqtest";
refuse = "runmvsd: Error on queue task:Sorry, you achieved max task number. Try once more later.";
commands = new QueueCommand[]{
new QueueCommand(TaskState.Queued, "task", "queued successfully"),
new QueueCommand(TaskState.Running, "task", "is in the run"),
new QueueCommand(TaskState.Running, "task", "started successfully"),
new QueueCommand(TaskState.Finished, "task", "complete"),
new QueueCommand(TaskState.NoSuchTask, "", "no such task")
};
}
}

View File

@@ -0,0 +1,10 @@
package _VisualDVM.GlobalData.Tasks.QueueSystem;
import Common.Utils.StringTemplate;
import _VisualDVM.GlobalData.Tasks.TaskState;
public class QueueCommand extends StringTemplate {
public TaskState state; //состояние задачи в случае успешного разбора этой команды.
public QueueCommand(TaskState state_in, String p, String s) {
super(p, s);
state = state_in;
}
}

View File

@@ -0,0 +1,36 @@
package _VisualDVM.GlobalData.Tasks.QueueSystem;
import Common.Utils.CommonUtils;
import _VisualDVM.GlobalData.Tasks.Task;
import _VisualDVM.GlobalData.Tasks.TaskState;
public class QueueSystem {
public String check_command;
public String cancel_command;
public String refuse;
QueueCommand[] commands;
public void checkTask(String Output, Task task) {
for (QueueCommand command : commands)
if (command.check(Output)) {
task.state = command.state;
return;
}
}
public void enqueueTask(String Output, Task task) {
if (Output.equalsIgnoreCase(refuse))
task.state = TaskState.FailedToQueue;
else
for (QueueCommand command : commands) {
String c_res = command.check_and_get_param(Output);
if (c_res != null) {
task.PID = c_res.replace("\"", "").replace("'", "");
task.state = command.state;
return;
}
}
}
public String getCheckTaskCommand(Task task) {
return check_command + " " + CommonUtils.DQuotes(task.PID);
}
public String getCancelTaskCommand(Task task) {
return cancel_command + " " + CommonUtils.DQuotes(task.PID);
}
}