diff --git a/dataforge-core/src/main/kotlin/hep/dataforge/context/PluginLoader.kt b/dataforge-core/src/main/kotlin/hep/dataforge/context/PluginLoader.kt index c1c7a40..d22a1db 100644 --- a/dataforge-core/src/main/kotlin/hep/dataforge/context/PluginLoader.kt +++ b/dataforge-core/src/main/kotlin/hep/dataforge/context/PluginLoader.kt @@ -120,7 +120,7 @@ abstract class AbstractPluginLoader : PluginLoader { protected fun compare(p1: PluginFactory, p2: PluginFactory): Int { - return Integer.compare(p1.tag.getInt("priority", 0), p2.tag.getInt("priority", 0)) + return p1.tag.getInt("priority", 0).compareTo(p2.tag.getInt("priority", 0)) } override fun listTags(): List { diff --git a/numass-viewer/build.gradle.kts b/numass-viewer/build.gradle.kts index 29d5320..ca939a0 100644 --- a/numass-viewer/build.gradle.kts +++ b/numass-viewer/build.gradle.kts @@ -19,7 +19,7 @@ application { mainClass.set("inr.numass.viewer.Viewer") } -version = "0.6.0" +version = "0.6.1" description = "The viewer for numass data" diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/DataController.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/DataController.kt index 891142e..9440566 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/DataController.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/DataController.kt @@ -41,15 +41,15 @@ class DataController : Controller(), ContextAware { val meta = point.meta - val channelSpectra: Deferred> = context.async(Dispatchers.IO) { + val channelSpectra: Deferred> = context.async { point.channels.mapValues { (_, value) -> analyzer.getAmplitudeSpectrum(value) } } - val spectrum: Deferred = context.async(Dispatchers.IO) { + val spectrum: Deferred
= context.async{ analyzer.getAmplitudeSpectrum(point) } - val timeSpectrum: Deferred
= context.async(Dispatchers.IO) { + val timeSpectrum: Deferred
= context.async{ val cr = spectrum.await().sumOf { it.getValue(NumassAnalyzer.COUNT_KEY).int }.toDouble() / point.length.toMillis() * 1000 @@ -117,7 +117,7 @@ class DataController : Controller(), ContextAware { } } val watcher = watchPath.fileSystem.newWatchService() - watchJob = app.context.launch(Dispatchers.IO) { + watchJob = app.context.launch { watcher.use { watcher -> val key: WatchKey = watchPath.register(watcher, StandardWatchEventKinds.ENTRY_CREATE) diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt index 2ffece4..811f45e 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt @@ -55,7 +55,7 @@ class HVView : View(title = "High voltage time plot", icon = ImageView(dfIcon)) } if (change.wasAdded()) { runLater { container.progress = -1.0 } - runGoal(app.context,"hvData[${change.key}]", Dispatchers.IO) { + runGoal(app.context,"hvData[${change.key}]") { change.valueAdded.getHvData() } ui { table -> if (table != null) { diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/MainView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/MainView.kt index be9d39d..93de7b6 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/MainView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/MainView.kt @@ -61,7 +61,7 @@ class MainView : View(title = "Numass viewer", icon = dfIconView) { } if (Files.exists(path.resolve(NumassDataLoader.META_FRAGMENT_NAME))) { //build set view - runGoal(app.context, "viewer.load.set[$path]", Dispatchers.IO) { + runGoal(app.context, "viewer.load.set[$path]") { title = "Load set ($path)" message = "Building numass set..." NumassDataLoader(app.context, null, path.fileName.toString(), path) diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/SlowControlView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/SlowControlView.kt index 751e3b6..d6d8d9d 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/SlowControlView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/SlowControlView.kt @@ -43,7 +43,7 @@ class SlowControlView : View(title = "Numass slow control view", icon = ImageVie plot.remove(change.key) } if (change.wasAdded()) { - runGoal(app.context,"loadTable[${change.key}]", Dispatchers.IO) { + runGoal(app.context,"loadTable[${change.key}]") { val plotData = change.valueAdded.asTable().await() val names = plotData.format.namesAsArray().filter { it != "timestamp" } diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/Viewer.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/Viewer.kt index ca1ad6b..a59533e 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/Viewer.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/Viewer.kt @@ -8,6 +8,7 @@ import hep.dataforge.fx.dfIcon import javafx.stage.Stage import org.slf4j.LoggerFactory import tornadofx.* +import kotlin.system.exitProcess /** * Created by darksnake on 14-Apr-17. @@ -28,6 +29,7 @@ class Viewer : App(MainView::class) { context.close() Global.terminate(); super.stop() + exitProcess(0) } }