Restore execution of multiple requests simultaneously

This commit is contained in:
Rohit Awate 2018-07-24 16:22:32 +05:30
parent c739f21337
commit e07c19aee6
2 changed files with 8 additions and 14 deletions

View file

@ -202,11 +202,6 @@ public class DashboardController implements Initializable {
@FXML @FXML
void sendRequest() { void sendRequest() {
if (requestManager != null && requestManager.isRunning()) {
snackbar.show("Please wait while the current request is processed.", 5000);
return;
}
if (responseBox.getChildren().size() == 2) { if (responseBox.getChildren().size() == 2) {
responseBox.getChildren().remove(0); responseBox.getChildren().remove(0);
responseArea.clear(); responseArea.clear();
@ -504,7 +499,6 @@ public class DashboardController implements Initializable {
@FXML @FXML
private void clearResponseArea() { private void clearResponseArea() {
responseBox.getChildren().remove(0);
responseArea.clear(); responseArea.clear();
showLayer(ResponseLayer.PROMPT); showLayer(ResponseLayer.PROMPT);
} }

View file

@ -51,9 +51,9 @@ public class DashboardState {
// ResponseLayer parameters // ResponseLayer parameters
private RequestManager requestManager; private RequestManager requestManager;
public void setRequestManager(RequestManager manager) { public void setRequestManager(RequestManager manager) {
this.requestManager = manager; this.requestManager = manager;
requestManager.removeEventHandler(WorkerStateEvent.WORKER_STATE_RUNNING, requestManager.getOnRunning());
requestManager.removeEventHandler(WorkerStateEvent.WORKER_STATE_SUCCEEDED, requestManager.getOnSucceeded()); requestManager.removeEventHandler(WorkerStateEvent.WORKER_STATE_SUCCEEDED, requestManager.getOnSucceeded());
requestManager.removeEventHandler(WorkerStateEvent.WORKER_STATE_FAILED, requestManager.getOnFailed()); requestManager.removeEventHandler(WorkerStateEvent.WORKER_STATE_FAILED, requestManager.getOnFailed());
@ -78,13 +78,6 @@ public class DashboardState {
response.getHeaders().forEach((key, value) -> responseHeaders.put(key, value.get(0))); response.getHeaders().forEach((key, value) -> responseHeaders.put(key, value.get(0)));
} }
public DashboardState() {
}
public DashboardState(ComposerState composer) {
this.composer = composer;
}
private void onRequestFailed(Event e) { private void onRequestFailed(Event e) {
this.visibleLayer = ResponseLayer.ERROR; this.visibleLayer = ResponseLayer.ERROR;
Throwable throwable = requestManager.getException(); Throwable throwable = requestManager.getException();
@ -124,4 +117,11 @@ public class DashboardState {
requestManager.reset(); requestManager.reset();
} }
public DashboardState() {
}
public DashboardState(ComposerState composer) {
this.composer = composer;
}
} }