Java

Structured Task Scope – New Concurrency Model in JVM

Since the advent of virtual threads in Java, we have had a new and nice concurrency model introduced as StructuredTaskScope. We will see some patterns in this new model. We need to know that with virtual threads, since they are very cheap, we don’t need to pool them. Also, we need to know that a virtual thread can pull its stack from...

by anil.gola
Tag: java 19
15-May-2023

Java

Java Project Loom – Launching 10 million threads (Part 2)

In the previous blog, we discussed a detailed overview of Project Loom. Now it’s time for some code. If you have not read about part 2 of this series, please check it out here: Let us see how we can create virtual threads in Java. Thread.ofVirtual().unstarted(() -> System.out.println("Thread is not started")); ...

by anil.gola
Tag: java 19
15-Mar-2023

Java

Java Project Loom – Virtual Threads (Part 1)

This JEP No 425 is something I am waiting for with bated breath. It’s a new notion that has been added to the concurrent APIs of JDK 19. It’s in the preview stage, and soon it will be a permanent feature in JDK in the coming few releases. Virtual Threads are light weight that reduce the effort of writing, maintaining and...

by anil.gola
Tag: java 19
13-Mar-2023