Java 19 And Beyond | New Parallelism Through Virtual Threads And Structured Concurrency

Sdílet
Vložit
  • čas přidán 21. 07. 2024
  • Java 19 was just released, and Java 21 is coming up fast too. I like to keep an eye on things coming up, so I wanted to share with you a video on parallelism features coming up in future Java releases. Java 19 parallelism will bring you two very cool things that originate from project Loom: Virtual Threading, and Structured Concurrency. In this little video, I'll explain what they are, and what they are good for, and will run a million threads in parallel just because I can. Join me for 15 minutes and perhaps learn something new.
    As always, if you get value or entertainment from this video, click the thumbs-up button to like it, and drop any questions or comments below the video. If you like to stay tuned to the next videos, remember to also subscribe and click that bell icon for notifications.
    Timecodes:
    0:00 - What's coming up in Java 19?
    0:35 - What are virtual threads and structured concurrency?
    2:12 - Virtual Threads in Java 19 - why and how?
    4:31 - Structured Concurrency in Java 19 - why and how?
    6:54 - How to run the preview/incubator samples right now?
    9:25 - Old thread model vs virtual threads performance
    12:26 - Let's run one million parallel threads
    13:26 - Examples of Structured Concurrency, what does parallelism control mean?
    Links in the video (Thanks for Rémi Forax for the cool samples!):
    - github.com/forax/loom-fiber/
    - download.java.net/java/early_...
    - social.ora.cl/6010Mpdz6
    - social.ora.cl/6015Mpdz1
    - social.ora.cl/6018Mpdzy
    - social.ora.cl/6010MpdzK

Komentáře • 16

  • @AsdAsdAsD2784
    @AsdAsdAsD2784 Před rokem +3

    Dude, the content is top notch ! Please, create a full hands-on tutorial on Java concurrency and include the newest features from Java 19 and onwards. I'm a junior developer and I'm sure there are a lot of people like me who can learn so much.

    • @DevXplaining
      @DevXplaining  Před rokem +2

      Hehe, thank you for your comment! Feedback like this is the fuel that keeps me motivated to produce more content, so very valuable!
      You know, I've been thinking of a concurrency video on Java for some time. It takes a bit more effort, yes, but I think parallelism features in Java are fascinating. You don't necessarily need to code them in most projects, but understanding them is important. And some of those features are just so cool. There have been multiple attempts to crack how to do it well in Java, and many libraries have been ported to use the latest ones.
      I have a template for such a video, I suppose I need to blow off the dust from it and start figuring out how to make it good :)

  • @daniellisboa1730
    @daniellisboa1730 Před rokem +1

    Great video!
    Thanks for sharing. Hyped to use this in production. Have to wait till lts, but already can see so many possibilities

    • @DevXplaining
      @DevXplaining  Před rokem

      Hi, and thank you for your comment! Much appreciated!
      Yeah, Java has got a lot of love for parallelism, and lots of options if you add it all together from the very beginning. I rarely get to play with these, since most of my work is on higher abstraction levels. But this excites me too, and every now and then there's a chance to apply all this power towards something useful.
      Mostly I keep up to date and share these so that when Java 21 will hit the release day next year, we all are prepared and know exactly what's in there, in case it's useful to us one day. There will again be a LOT of changes! :)

  • @mariarussapt
    @mariarussapt Před rokem +2

    Great video! Yes, I would like to see you dive in more into virtual threads

    • @DevXplaining
      @DevXplaining  Před rokem

      Thank you! Heh, well I have some ideas... :) And next week, more Java 19 goodness too!

  • @omarhosny6947
    @omarhosny6947 Před rokem +1

    Thank you for your great efforts. I’d like to see more about the async part using Loom with a real example

    • @DevXplaining
      @DevXplaining  Před rokem

      Thank you! I may not be doing that in neat future, but plan to go into whole Java parallelism at some point more.
      Meanwhile, as Java 19 was just released, excpect more videos popping in. I already saw some deeper dives into it.

  • @jackdanyal4329
    @jackdanyal4329 Před rokem +2

    nice video, thank you! but code is a little bit harder to read because of color theme :)

    • @DevXplaining
      @DevXplaining  Před rokem +2

      Ah, thank you for the feedback! I need to pay a bit more attention to that next time, it's the kind of thing I didn't notice myself. Should be an easy fix. Much appreciated!

    • @jackdanyal4329
      @jackdanyal4329 Před rokem

      @@DevXplaining thank you for the great content

  • @cya3mdirl158
    @cya3mdirl158 Před rokem +1

    What about fact that memory is allicated on heap?😊

  • @technicholy1299
    @technicholy1299 Před rokem +1

    Java is getting coroutines from Kotlin.
    You can get in big trouble with this if misapplied.

    • @DevXplaining
      @DevXplaining  Před rokem +1

      Oh yes, any powerful tools... Especially parallelism :)

    • @technicholy1299
      @technicholy1299 Před rokem

      ​@@DevXplaining I'd be interested to see the observer pattern used in java with this to handle a network call or complicated db call