please include function webs_readTripleFileAsTriples. static L webs_readTripleFileAsTriples_parallel2(File f) ctex { if (!f.exists()) ret ll(); time "Getting names" { Iterator it = linesFromFile(f); final new L names; while (it.hasNext()) { S s = trim(it.next()); if (empty(s)) break; names.add(symbol(unquote(s))); } } if (webs_readTripleFileAsTriples_debug) print("Have " + l(names) + " names"); final L, Int>> triples = new L; int poolSize = numberOfCores(), queueSize = 10000; int blockSize = 1000; NotifyingBlockingThreadPoolExecutor e = new(poolSize, queueSize, 15, TimeUnit.SECONDS); print("Using " + poolSize + " cores, block size: " + blockSize + "."); try { int i = 0; L block = emptyListWithCapacity(blockSize); while licensed { ++i; final Int _i = i; bool hasNext = it.hasNext(); if ((!hasNext || l(block) >= blockSize) && nempty(block)) { final L _block = cloneList(block); e.execute(r { pcall { L l = emptyListWithCapacity(_block); for (S s : _block) { TripleWeb w = webs_readTripleFileAsTriples_line(s, names); if (w != null) l.add(w); } synchronized(triples) { triples.add(pair(l, _i)); } }}); block.clear(); } if (hasNext) block.add(it.next()); else break; } e.shutdown(); e.awaitTermination(1, TimeUnit.DAYS); } finally { e.shutdown(); } sortBySecondOfPairs_inPlace(triples); int n = 0; for (Pair, Int> p : triples) n += l(p.a); L l = emptyListWithCapacity(n); for (Pair, Int> p : triples) l.addAll(p.a); ret l; }