static L websMadeByProgram_parallel(S progID) { ret websMadeByProgram_parallel(progID, null); } static L websMadeByProgram_parallel(S progID, final Map furtherInfoMap) ctex { // TODO: clean up file handle in case of error IterableIterator l = scanLog_iterator(progID, "webs-made.txt"); fS src = progID; final new L> webs; int poolSize = numberOfCores(), queueSize = 20; NotifyingBlockingThreadPoolExecutor e = new(poolSize, queueSize, 15, TimeUnit.SECONDS); try { int i = 0; for (fS s : l) { ++i; final int _i = i; e.execute(r { pcall { SoftwareMadeWeb o = cast unstructure(s); Web web = o.web; if (web == null) web = (Web) unstructure(o.structure); if (web != null) synchronized(webs) { webs.add(pair(web_intern(web_setSourceIfEmpty(web, src)), _i)); mapPut(furtherInfoMap, web, o); } }}); } //e.await(); // ConcurrentModificationException sometimes?? e.shutdown(); e.awaitTermination(1, TimeUnit.DAYS); } finally { e.shutdown(); } time "Sort" { sortBySecondOfPairs_inPlace(webs); } ret concatLists(ai_triplesMadeByProgram(progID), firstOfPairs(webs)); }