Chat Logs

  1. internecineWho uses GitHub copilot at work and is limited by tokens. How many tokens are you allotted
  2. enoqwhen creating a completablefuture inside a virtual thread, does the future suspend on the VT like any other I/O operation?
  3. enoqor does awaiting the future block the carrier thread that launched the VT
  4. enoqat least to me it looks like I need to provide an executor like this var executor = Executors.newVirtualThreadPerTaskExecutor();
  5. nimajeisn't a future just a container to write the result into, without any information how the result will be computed? so what happens should depend on whatever gives you that future, in the worst case it just crates it and never calls .complete(โ€ฆ) on it
  6. enoqmy understanding is that the future forks off a new thread and then .get() blocks the thread it is on
  7. enoqwhat I don't know is if the default thread type is changed when running inside a VT and if .get() inside a VT suspend
  8. enoq+s
  9. nimajethat sounds more like FutureTask, how should the Future know what it should do? And where did you get that idea that it would spawn a thread? Especially as CompletableFuture has "this class has no direct control over the computation" in its docs
  10. deebothere's CompletableFuture.supplyAsync(task, executor)
  11. nimajeyeah, that is one way to create a CompletableFuture that excactly tells you how the result will be computed, even if I don't understand why that gives you a CompletableFuture instead of just a Future, are there really use cases where you want to submit some work, but have the possibility to complete it yourself some other way?
  12. Pararelevant https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/CompletionStage.html
  13. nevetCompletionStage (Java SE 21 & JDK 21)
  14. enoqmaybe another way to frame this: is there a list of java APIs that suspend on virtual threads
  15. cheeseri'm not aware that libraries need to do anything for virtual threads.