executor 2 change
This commit is contained in:
@@ -46,8 +46,8 @@ public class GetAssignmentAdapter implements GetAssignmentPort {
|
||||
if (response.body().equals("")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Task(new JSONObject(response.body()).getString("taskID"));
|
||||
JSONObject responseBody = new JSONObject(response.body());
|
||||
return new Task(responseBody.getString("taskID"), responseBody.getString("input"));
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||
|
@@ -61,7 +61,7 @@ public abstract class ExecutorBase {
|
||||
System.out.println("Starting execution");
|
||||
this.status = ExecutorStatus.EXECUTING;
|
||||
|
||||
task.setResult(execution());
|
||||
task.setResult(execution(task.getInput()));
|
||||
|
||||
executionFinishedEventPort.publishExecutionFinishedEvent(
|
||||
new ExecutionFinishedEvent(task.getTaskID(), task.getResult(), "SUCCESS"));
|
||||
@@ -70,6 +70,6 @@ public abstract class ExecutorBase {
|
||||
getAssignment();
|
||||
}
|
||||
|
||||
protected abstract String execution();
|
||||
|
||||
protected abstract String execution(String... input);
|
||||
|
||||
}
|
||||
|
@@ -12,8 +12,12 @@ public class Task {
|
||||
@Setter
|
||||
private String result;
|
||||
|
||||
public Task(String taskID) {
|
||||
@Getter
|
||||
private String[] input;
|
||||
|
||||
public Task(String taskID, String... input) {
|
||||
this.taskID = taskID;
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user