Hi -
I've created an import script that creates/updates objects from Excel. I would like to make this run faster with threads, but I can't get the code working.
This page was my reference: https://crunchify.com/how-to-run-multiple-threads-concurrently-in-java-executorservice-approach/
Does anyone know how to do something like this within the context of the ARIS API? Here is a sample script I was trying:
var log = "";
function main() {
var MYTHREADS = 4;
var executor = new java.util.concurrent.Executors.newFixedThreadPool(MYTHREADS);
var objectNames = ["Object 1", "Object 2", "Object 3", "Object 4"];
for (var i in objectNames) {
var objName = objectNames[i];
var worker = new MyRunnable(objName);
executor.execute(worker);
}
executor.shutdown();
// Wait until all threads are finish
while (!executor.isTerminated()) {
}
Dialogs.MsgBox("\nFinished all threads");
}
function MyRunnable(objName) {
this.objName = objName;
this.run = function() {
var result = "";
try {
var oObjDef = ArisData.getActiveDatabase().RootGroup().CreateObjDef(Constants.OT_FUNC, this.objName, 1033);
} catch (e) {
result = "->Red<-\t";
}
log += this.objName + " created\n";
}
}
main();
Michael Idengren on
I also need this, for the purpose of running a high volume of automated consolidations. Every consolidation between two objects takes 30seconds+, and processing 14,000 objects that have one duplicate each is taking many, many hours, with an under-utilized server CPU load between 4-10% ...