-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fiber refactorings #8
base: java21_rethreader
Are you sure you want to change the base?
Conversation
@@ -691,7 +691,7 @@ public static void main(String[] args) throws IOException, InterruptedException | |||
}}); | |||
ArgumentParser.fillOptions(new Class[]{OpenIE.class, ArgumentParser.class}, props); | |||
AtomicInteger exceptionCount = new AtomicInteger(0); | |||
ExecutorService exec = Executors.newFixedThreadPool(ArgumentParser.threads); | |||
ExecutorService exec = Executors.newVirtualThreadPerTaskExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hit by tests run by mvn install
@@ -956,7 +956,7 @@ public static Counter<CandidatePhrase> runLabelSeedWords(Map<String, DataInstanc | |||
|
|||
Redwood.log(Redwood.DBG,"ignoreCaseSeedMatch is " + constVars.ignoreCaseSeedMatch); | |||
List<List<String>> threadedSentIds = getThreadBatches(new ArrayList<>(sents.keySet()), constVars.numThreads); | |||
ExecutorService executor = Executors.newFixedThreadPool(constVars.numThreads); | |||
ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hit by tests run by mvn install
@@ -1636,7 +1636,7 @@ private void calculateSufficientStats(Map<String, DataInstance> sents, | |||
List<List<String>> sampledSentIds = splitIntoNumThreadsWithSampling(CollectionUtils.toList(sents.keySet()), sampleSize, constVars.numThreads); | |||
Redwood.log(Redwood.DBG,"sampled " + sampleSize + " sentences (" + constVars.sampleSentencesForSufficientStats*100 + "%)"); | |||
|
|||
ExecutorService executor = Executors.newFixedThreadPool(constVars.numThreads); | |||
ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hit by tests run by mvn install
@@ -232,7 +232,7 @@ private void runParallelApplyPats(Map<String, DataInstance> sents, String label, | |||
else | |||
num = sents.size() / (numThreads - 1); | |||
|
|||
ExecutorService executor = Executors.newFixedThreadPool(constVars.numThreads); | |||
ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hit by tests run by mvn install
@@ -455,7 +455,7 @@ Set<CandidatePhrase> chooseUnknownAsNegatives(Set<CandidatePhrase> candidatePhra | |||
|
|||
AtomicDouble allMaxSim = new AtomicDouble(Double.MIN_VALUE); | |||
|
|||
ExecutorService executor = Executors.newFixedThreadPool(constVars.numThreads); | |||
ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hit by tests run by mvn install
@@ -905,7 +905,7 @@ public GeneralDataset<String, ScorePhraseMeasures> choosedatums(boolean forLearn | |||
Data.computeRawFreqIfNull(sents, PatternFactory.numWordsCompoundMax); | |||
|
|||
List<List<String>> threadedSentIds = GetPatternsFromDataMultiClass.getThreadBatches(new ArrayList<>(sents.keySet()), constVars.numThreads); | |||
ExecutorService executor = Executors.newFixedThreadPool(constVars.numThreads); | |||
ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hit by tests run by mvn install
this.serverExecutor = Executors.newFixedThreadPool(ArgumentParser.threads); | ||
this.corenlpExecutor = Executors.newFixedThreadPool(ArgumentParser.threads); | ||
this.serverExecutor = Executors.newVirtualThreadPerTaskExecutor(); | ||
this.corenlpExecutor = Executors.newVirtualThreadPerTaskExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hit by tests run by mvn install
@@ -498,7 +498,7 @@ public static void main(String[] args) { | |||
|
|||
final SpanishXMLTreeReaderFactory trf = new SpanishXMLTreeReaderFactory(true, true, ner, detailedAnnotations, expandElisions, expandConmigo); | |||
ExecutorService pool = | |||
Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); | |||
Executors.newVirtualThreadPerTaskExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hit by tests run by mvn install
// Default should be false | ||
threadPool.allowCoreThreadTimeOut(false); | ||
threadPool.prestartAllCoreThreads(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are functions of ThreadPoolExecutor
, not ExecutorService
threadPool.getQueue().size(), | ||
outputQueue.size(), | ||
idleProcessors.size()); | ||
return ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto the above
@@ -128,7 +128,7 @@ public int size() { | |||
public static void main(final String[] args) throws InterruptedException { | |||
final Thread[] threads = new Thread[100]; | |||
for (int i = 0; i < threads.length; i++) { | |||
threads[i] = new Thread(() -> { | |||
threads[i] = Thread.ofVirtual().unstarted(() -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hit by tests run by mvn install
@@ -1136,7 +1136,7 @@ public static void threadAndRun(String title, Iterable<Runnable> runnables, int | |||
return; | |||
} | |||
//(create executor) | |||
ExecutorService exec = Executors.newFixedThreadPool(numThreads); | |||
ExecutorService exec = Executors.newVirtualThreadPerTaskExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hit by tests run by mvn install
@@ -1462,7 +1462,7 @@ public static void main(String[] args){ | |||
Redwood.getHandler(ConsoleHandler.class).minLineCountForTrackNameReminder = 50; | |||
|
|||
//--Multithreading | |||
ExecutorService exec = Executors.newFixedThreadPool(10); | |||
ExecutorService exec = Executors.newVirtualThreadPerTaskExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hit by tests run by mvn install
No description provided.