3 ms·
In the JEP they reference go and erlang as other examples of successful runtimes adopting this approach. Which is true around the M:N stuff, but the missing pi
by djhworld 4y ago
In the JEP they reference go and erlang as other examples of successful runtimes adopting this approach.
Which is true around the M:N stuff, but the missing piece is the communication. Go has channels, Erlang uses the actor model, do you know if there are any plans to have something like this in Java?
- kaba0 4y agoGo has those inbuilt because before generics the language simply wasn’t expressive enough for such constructs.
- Skinney 4y agoYou already have queues in Java. They should work just fine with virtual threads, as they do on regular threads.
- pjmlp 4y agoJava already has better ways to do that on java.util.concurrent, and structured concurrency is coming as well.
- PaulHoule 4y agoI wasn't too impressed when I read the docs on structured concurrency but they might flesh them out. Frequently I've written applications that use Executors, Reactive Streams, etc. and found that frameworks like that rarely, if ever, provide a good answer for how to tear a processing system down at the end. It's completely practical to use a stream processing framework to process batch jobs, but to get correct answers you have to shut the thing down at the end. I've frequently built teardown systems and it's always left me with the feeling that system programmers should occasionally climb down from their high horse and write an application.
- Skinney 4y ago> but to get correct answers you have to shut the thing down at the end That's one of the things structured concurrency improves on. By defining a scope in a try-with-resources block, you make sure it's teared down at the end of whatever operation you perform.
- PaulHoule 4y agoI have to look at in more depth. In the systems I've built there are frequently a few queues and also some resources such as a MapDB or Jena instance, "shutting down" is a matter of flushing out the queues and closing the resources in dependency order. One of them used the Jena Rules Engine as a control plane, effectively a group of production rules that build all the queues, initialize the processing elements, resources, etc. I got told by the Jena people that this use case was not supported but it worked pretty well.