static L webs_readTripleFile_parallel(File f) ctex { if (!f.exists()) ret ll(); print("Reading " + f2s(f) + " in " + nCore(numberOfCores())); time "webs_readTripleFile_parallel" { time "Reading names" { Iterator it = linesFromFile(f); final new L names; while (it.hasNext()) { S s = trim(it.next()); if (empty(s)) break; names.add(unquote(s)); } } final new L> webs; int poolSize = numberOfCores(), queueSize = 1000; NotifyingBlockingThreadPoolExecutor e = new(poolSize, queueSize, 15, TimeUnit.SECONDS); try { int i = 0; for (fS s : iterable(it)) { ++i; final int _i = i; e.execute(r { pcall { Web web = webs_readTripleFile_line(s, names); if (web != null) synchronized(webs) { webs.add(pair(web, _i)); } }}); } e.shutdown(); e.awaitTermination(1, TimeUnit.DAYS); } finally { e.shutdown(); } L result = firstOfPairs(sortBySecondOfPairs_inPlace(webs)); } ret result; }