From 645bf5eea4a65c015e2308bb9544e478aa5d493e Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 1 Aug 2016 21:37:59 +0300 Subject: [PATCH] [no commit message] --- .../java/inr/numass/actions/ReadNumassStorageAction.java | 7 ++++--- .../main/java/inr/numass/viewer/MainViewerController.java | 4 ++-- .../src/main/java/inr/numass/viewer/MspViewController.java | 2 +- .../java/inr/numass/viewer/NumassLoaderViewComponent.java | 6 +++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/numass-main/src/main/java/inr/numass/actions/ReadNumassStorageAction.java b/numass-main/src/main/java/inr/numass/actions/ReadNumassStorageAction.java index 66e13d09..fed07771 100644 --- a/numass-main/src/main/java/inr/numass/actions/ReadNumassStorageAction.java +++ b/numass-main/src/main/java/inr/numass/actions/ReadNumassStorageAction.java @@ -6,7 +6,6 @@ package inr.numass.actions; import hep.dataforge.actions.GenericAction; -import hep.dataforge.computation.Work; import hep.dataforge.computation.WorkManager.Callback; import hep.dataforge.data.Data; import hep.dataforge.data.DataFilter; @@ -21,6 +20,7 @@ import inr.numass.storage.NumassData; import inr.numass.storage.NumassDataLoader; import inr.numass.storage.NumassStorage; import inr.numass.storage.SetDirectionUtility; +import java.util.concurrent.CompletableFuture; /** * @@ -42,7 +42,8 @@ public class ReadNumassStorageAction extends GenericAction { boolean reverseOnly = actionMeta.getBoolean("reverseOnly", false); //FIXME make Work actually submitted only when calculation starts - Work> process = getContext().workManager() + + CompletableFuture> future = getContext().workManager() .>post(getName(), (Callback callback) -> { //FIXME remove in later revisions SetDirectionUtility.load(getContext()); @@ -83,7 +84,7 @@ public class ReadNumassStorageAction extends GenericAction { return builder.build(); }); - return process.getTask().get(); + return future.get(); } catch (Exception ex) { throw new RuntimeException("Failed to load storage", ex); } diff --git a/numass-viewer/src/main/java/inr/numass/viewer/MainViewerController.java b/numass-viewer/src/main/java/inr/numass/viewer/MainViewerController.java index dac79f6d..1b91d6d5 100644 --- a/numass-viewer/src/main/java/inr/numass/viewer/MainViewerController.java +++ b/numass-viewer/src/main/java/inr/numass/viewer/MainViewerController.java @@ -139,7 +139,7 @@ public class MainViewerController implements Initializable { } private void loadDirectory(String path) { - getContext().workManager().post("viewer.loadDirectory", (WorkManager.Callback callback) -> { + getContext().workManager().submit("viewer.loadDirectory", (WorkManager.Callback callback) -> { callback.updateTitle("Load storage (" + path + ")"); callback.setProgress(-1); callback.updateMessage("Building numass storage tree..."); @@ -162,7 +162,7 @@ public class MainViewerController implements Initializable { public void setRootStorage(NumassStorage root) { getContext().workManager().cleanup(); - getContext().workManager().post("viewer.storage.load", (WorkManager.Callback callback) -> { + getContext().workManager().submit("viewer.storage.load", (WorkManager.Callback callback) -> { callback.updateTitle("Fill data to UI (" + root.getName() + ")"); callback.setProgress(-1); Platform.runLater(() -> statusBar.setProgress(-1)); diff --git a/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java b/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java index da915ea0..8fd0b6a8 100644 --- a/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java +++ b/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java @@ -85,7 +85,7 @@ public class MspViewController { public void fillMspData(Storage rootStorage) { if (rootStorage != null) { - context.workManager().post("viewer.msp.fill", (WorkManager.Callback callback) -> { + context.workManager().submit("viewer.msp.fill", (WorkManager.Callback callback) -> { try { // callback.updateTitle("Fill msp data (" + rootStorage.getName() + ")"); diff --git a/numass-viewer/src/main/java/inr/numass/viewer/NumassLoaderViewComponent.java b/numass-viewer/src/main/java/inr/numass/viewer/NumassLoaderViewComponent.java index f0e1c377..f7051d2e 100644 --- a/numass-viewer/src/main/java/inr/numass/viewer/NumassLoaderViewComponent.java +++ b/numass-viewer/src/main/java/inr/numass/viewer/NumassLoaderViewComponent.java @@ -227,7 +227,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab public void loadData(NumassData data) { this.data = data; if (data != null) { - context.workManager().>post("viewer.numass.load", (WorkManager.Callback callback) -> { + context.workManager().>submit("viewer.numass.load", (WorkManager.Callback callback) -> { callback.updateTitle("Load numass data (" + data.getName() + ")"); points = data.getNMPoints(); @@ -252,7 +252,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab } private void setupHVPane(Supplier hvData) { - context.workManager().post("viewer.numass.hv", (WorkManager.Callback callback) -> { + context.workManager().submit("viewer.numass.hv", (WorkManager.Callback callback) -> { Table t = hvData.get(); Platform.runLater(() -> { if (t != null) { @@ -356,7 +356,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab detectorPlot.removePlot(); } - context.workManager().post("viewer.numass.load.detector", (WorkManager.Callback callback) -> { + context.workManager().submit("viewer.numass.load.detector", (WorkManager.Callback callback) -> { Meta plottableConfig = new MetaBuilder("plot") .setValue("connectionType", "step") .setValue("thickness", 2)