davidtos / virtual_thread_workshop

9 stars 3 forks source link

Make sure the ScopedValue is binded to the task #3

Open ia3andy opened 4 weeks ago

ia3andy commented 4 weeks ago
try {
    final String url = queue.take();
    ScopedValue.runWhere(Scrape.URL, url, scrape);
} catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new RuntimeException(e);
}

In that case this is using a ScopedValue<String> which can be used in the whole Scrape without recalling the supplier.