Use context dispatcher everywhere
This commit is contained in:
parent
c2d2813622
commit
307d4cb18a
@ -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<PluginTag> {
|
||||
|
@ -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"
|
||||
|
||||
|
@ -41,15 +41,15 @@ class DataController : Controller(), ContextAware {
|
||||
|
||||
val meta = point.meta
|
||||
|
||||
val channelSpectra: Deferred<Map<Int, Table>> = context.async(Dispatchers.IO) {
|
||||
val channelSpectra: Deferred<Map<Int, Table>> = context.async {
|
||||
point.channels.mapValues { (_, value) -> analyzer.getAmplitudeSpectrum(value) }
|
||||
}
|
||||
|
||||
val spectrum: Deferred<Table> = context.async(Dispatchers.IO) {
|
||||
val spectrum: Deferred<Table> = context.async{
|
||||
analyzer.getAmplitudeSpectrum(point)
|
||||
}
|
||||
|
||||
val timeSpectrum: Deferred<Table> = context.async(Dispatchers.IO) {
|
||||
val timeSpectrum: Deferred<Table> = 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)
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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" }
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user