File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
bulk-model-sync-mps/src/main/kotlin/org/modelix/mps/model/sync/bulk Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import org.modelix.model.sync.bulk.ModelImporter
27
27
import org.modelix.model.sync.bulk.import
28
28
import org.modelix.model.sync.bulk.isModuleIncluded
29
29
import java.io.File
30
+ import java.util.concurrent.atomic.AtomicInteger
30
31
31
32
object MPSBulkSynchronizer {
32
33
@@ -43,12 +44,18 @@ object MPSBulkSynchronizer {
43
44
}
44
45
val numIncludedModules = includedModules.count()
45
46
val outputPath = System .getProperty(" modelix.mps.model.sync.bulk.output.path" )
47
+ val counter = AtomicInteger ()
46
48
47
- for ((index, module) in includedModules.withIndex()) {
48
- println (" Exporting module ${index + 1 } of $numIncludedModules : '${module.moduleName} '" )
49
- val exporter = ModelExporter (MPSModuleAsNode (module))
50
- val outputFile = File (outputPath + File .separator + module.moduleName + " .json" )
51
- exporter.export(outputFile)
49
+ includedModules.parallelStream().forEach { module ->
50
+ val pos = counter.incrementAndGet()
51
+
52
+ repository.modelAccess.runReadAction {
53
+ println (" Exporting module $pos of $numIncludedModules : '${module.moduleName} '" )
54
+ val exporter = ModelExporter (MPSModuleAsNode (module))
55
+ val outputFile = File (outputPath + File .separator + module.moduleName + " .json" )
56
+ exporter.export(outputFile)
57
+ println (" Exported module $pos of $numIncludedModules : '${module.moduleName} '" )
58
+ }
52
59
}
53
60
}
54
61
}
You can’t perform that action at this time.
0 commit comments