8 ms·
Java 24
- theandrewbailey 2y agoNew features: https://openjdk.org/projects/jdk/24/ https://openjdk.org/projects/jdk/24/
- re-thc 2y agoFinally no pinning for virtual threads!
- bullen 2y agoYes! I will compare my NIO multiplayer system to SVTwP (Sync. Virt. Threads without Pinning) and report back!
- rockyj 2y agoWhat will be the implications of this? e.g. Can we now handle more req/sec on I/O blocking services, because more requests can be serviced by VTs and they will not be blocked waiting for IO, so kinda like Node.js async model (for free) but with multiple threads?
- samus 2y agoThat was always possible and the whole point of virtual threads. This concerns reliability. So far there was this annoying papercut of virtual threads not freeing up their carrier thread when they were waiting to enter a `synchronized` lock. That could easily lead to reduced throughput or even deadlocks when all carrier threads got pinned.
- rockyj 2y agoYeah, I mean now we can start using VTs on any system / lib without being worried of pinning. Isn't this a "huge" deal? Why is the community not shouting from the rooftops about this? Theoretically it means, Java has now bettered Node.js "async / await" approach and that too without the two colored function approach. One process can now spawn thousands of threads to service IO and none of those threads are blocking / waiting (and with this release there is no gotcha / pitfall remaining). Not mention all the Netty / reactive libraries have no use now (not that I am complaining).
- samus 2y agoIndeed, the relief is great. However, there are relatively few users of virtual threads yet. Even fewer are keeping up with the releases. Those using it in production already managed to work around the issues or have given up on it. We will hear more when Java 25 is released (which will be an Oracle LTS version) or if a backport to LTS 21 happens.
- munksbeer 2y ago> Not mention all the Netty / reactive libraries have no use now (not that I am complaining). Netty uses an eventloop/async paradigm. The benefit of that style is you do not need any locking (within the same eventloop). How does virtual threads make that of no use?
- rockyj 2y agoNo need for complex async / event loop stuff. VTs can be spawned by millions and they will not block the thread (/CPU) while doing IO, in this (win-win) scenario there is no value in doing complex (and 2 colored) async programming.
- munksbeer 2y agoYou didn't answer the question though. When I use a single threaded event loop with async style, I don't need to use any locks. It isn't about efficiency, it is about low complexity because I don't need to reason about shared state. Is it good practice or not to use locking semantics if you use virtual threads?
- hmottestad 2y agoYou can now safely use virtual threads to run code that uses "synchronized".
- skerit 2y agoAs someone coming from Node.js: virtual threads are amazing. Async behaviour without the async/await headaches.
- ludovicianul 2y agoMy first experience with virtual threads was way less memory used.
- znpy 2y ago> My first experience with virtual threads was way less memory used. understandable. Normal java threads have underlying OS threads, which have their own stack and memory overhead. virtual threads are much lighter in this sense.
- bullen 2y agoFor ARM32 and Risc-V releases they should appear in the coming days here: https://bell-sw.com/pages/downloads https://bell-sw.com/pages/downloads Raspberry 2 and Vision Five 2 are very future proof peices of hardware that Oracle and OpenJDK ignores!
- lordleft 2y agoDumb question, but what are the licensing implications between using an OpenJDK vs the official Oracle Release of the JDK?
- samus 2y agoForgive me if I answer with a counter-question, but why would you use the Oracle distribution without paying for Oracle support too?
- rafram 2y agoBecause it’s what came up when you googled “install java on aws”.
- ludovicianul 2y agoThey are both free (Oracle relaxed their license in 2021) with some caveats. If you choose Oracle, to continue to be free, you must always use latest Java version, otherwise you need to pay for security patches. This means updating every 6 months with each Java release.
- daitangio 2y agoYes. Oracle version is not free anymore: you need at least an Oracle product to use it. As far as I know, it is "free of charge" if you have an Oracle DB license. So avoid oracle version outside enterprise contract
- ludovicianul 2y agoIt's free. But you must always use latest Java.
- jillesvangurp 2y agoUnless you need Oracle's JDK specifically, use one of several certified OpenJDK distributions. Amazon Coretto is a popular choice and they already have a v24 version. There are a few others. Temurin (weird name but basically the eclipse.org one) doesn't yet have one but is popular. At this point there is no/little functional difference between distributions. The main reasons for using Oracle's distribution are usually non-technical and have to do with compliance, existing license & support agreements with Oracle. Unless you are a bank (or similar organization) that has deals with Oracle on this or your CIO/CTO/legal tells you to use Oracle, you should avoid Oracle. There is no technical advantage and you potentially expose yourself to complicated licensing and commercial requirements and related auditing requirements.
- learncomputer 2y agoJava 24 already? What’s the standout feature this time—anything that makes it worth upgrading from 21? Always cool to see how it keeps evolving.
- MarkMarine 2y agoMy favorite is the stream gatherers, an addition to the stream processing API that will let streams do things like sliding windows. https://docs.oracle.com/en/java/javase/22/core/stream-gatherers-01.html https://docs.oracle.com/en/java/javase/22/core/stream-gather... Ahead Of Time (AOT) linking is nice as well, should cut down cold start time.
- fiddlerwoaroof 2y agoAre record patterns stable yet?
- Tomte 2y agoJava releases are timeboxed, so they don't need standout features.
- smallmancontrov 2y agoOoh, looks like they sync up with years going forward. That's... actually really quite nice. https://www.java.com/releases/matrix/ https://www.java.com/releases/matrix/
- atomicnumber3 2y agoSecurityManager dies not with a bang, but a whimper. The professor who taught a generally-misguided Java elective extolled the benefits of the security manager whenever he could. I was tremendously skeptical at the time. I'm inappropriately smug to have been proven right now, several decades later. I really want structured concurrency out of preview!! I think it helps close one of the last gaps golang has over Java in the ease-of-concurrent-programming side of things. Go makes channels and waitgroups pretty easy. I think structured concurrency is a great side-step of those primitives by actually making the higher-level tasks you use those tools to accomplish easier to write and reason about. Continuing a trend I see where go tends to have somewhat better primitives, but then obstinately does nothing with them to actually make the higher-level tasks easier to accomplish. No pinning virtual threads is huge. Finally you can virtual thread with near-wild abandon, as God intended. Love seeing Streams still getting love. I do a lot of fizzbuzz-esque interviews (the "can you code your way out of a paper bag" type screens) for my company and I think it says a lot that, in general, people who pick Java and use streams pass but people who don't use streams often get tripped up in their loop logic and fail (or, even if they don't fail per se, don't pass). It says a lot about ergonomics and intuitiveness, and also the power of the abstraction to tersely and compactly solve real problems, when a language is a big ally in interviews. And the cool thing about Java streams is that they're as powerful as Ruby's functional-style operation chaining (arr.map{}.reduce(:+) etc) but they're actually performant. I feel it also bears mentioning that people who use Ruby in these interviews, few as they are, almost always pass and do so while writing very few LOC :)
- MarkMarine 2y agoGo is the poster child for not having structured concurrency, the article that started this movement was an explicit take down of go’s concurrency primitive “go func” being dangerous. https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/ https://vorpus.org/blog/notes-on-structured-concurrency-or-g... I think Kotlin still leads here, and even the Java changes don’t have the same nice ergonomics you get with Kotlin’s DSL. Would love to see more tenseness from Kotlin leak into Java.
- 2y ago
- dpratt 2y agoJEP 484: Classfile API is going to be huge. It will take a while for full adoption, but finally being able abstract the backend of ByteBuddy/ASM/etc will be a gigantic boon. Being able to read/write classifies is one of the biggest hurdles at upgrade time.
- satvikpendem 2y agoHow is Java these days compared to Kotlin, comparing latest versions of both? I know Java continues to improve and take features from Kotlin but Kotlin is also improving itself.
- dtech 2y agoIt's a perpetual discussion. Java enthusiasts will generally say there is no or only a small difference, while at the same time being excited about Java getting features that Kotlin has had years before (e.g. smart casting). In general Java is getting better but more weighed down by legacy and existing design decisions than Kotlin, so a lot of improvements from Kotlin are not possible to be made in Java. Java is running ahead of Kotlin in a few things, mainly virtual threads which don't require black-red functions like coroutines.
- pjmlp 2y agoIt is the Java Virtual Machine, not Kotlin Virtual Machine. Thus Kotlin will always be a guest language and not the target of all companies designing JVM implementations. That is left for Google with their .NET flavour, ART + Kotlin, where Android Java plays the same role as J# did for .NET, after Microsoft had let go of J++.
- msgilligan 2y ago> Thus Kotlin will always be a guest language If you a writing libraries for the JVM, Java is preferred to Kotlin because it does not drag along a standard library dependency. To be fair there is Kotlin Multiplatform where this is not the case. https://kotlinlang.org/docs/multiplatform.html https://kotlinlang.org/docs/multiplatform.html
- pjmlp 2y agoYes, and it has the issue of having its own way of #ifdef, because not all platforms offer the same semantics. It is no different than writing C code across UNIX, Windows, mainframe, microcomputers and embedded, consoles, and somehow work across all of them.
- pjmlp 2y agoAlready installed, GraalVM is also available for Java 24. Lots of goodies.
- magicmicah85 2y agoJava’s version growth has been interesting to watch the past few years. I remember thinking “wow 9 is out, now 10, 11 is an LTS, we’ll go to that”. Still on Java 8. Too much other things to do.
- znpy 2y ago> Still on Java 8. Too much other things to do. Understandable. Depending on your use-case, sure go ahead and stay there. However keep in mind that you're missing out on a lot of stuff. Java 8 is like literally from 11 years ago.
- winrid 2y agoYou could potentially save money by upgrading, but likely 8 will continue to work fine for a long time. That's java for you.
- sobrinth 2y agoIt sure is weird seeing such high numbers. After pivoting away from java for a new job 4 years ago, I still get confused when people from 'old job' talk about how Java 24 is now here. Kinda fun to think about that we'll have Java 30 before 2030 iirc.
- 0x1ceb00da 2y agoI stopped following java ecosystem closely around the time java 9 was released (last new thing I remember is the introduction of modules). How much has the language/bytecode/VM changed since then? What would be the best resources to catch up that won't take too much of my time?
- pjmlp 2y agoHere there you go, This will get you up to Java 21, https://advancedweb.hu/a-categorized-list-of-all-java-and-jvm-features-since-jdk-8-to-21/ https://advancedweb.hu/a-categorized-list-of-all-java-and-jv... For the remaining ones, https://www.infoworld.com/article/2335077/jdk-22-the-new-features-in-java-22.html https://www.infoworld.com/article/2335077/jdk-22-the-new-fea... https://www.infoworld.com/article/2336682/jdk-23-the-new-features-in-java-23.html https://www.infoworld.com/article/2336682/jdk-23-the-new-fea... https://www.infoworld.com/article/3491404/jdk-24-the-new-features-in-java-24.html https://www.infoworld.com/article/3491404/jdk-24-the-new-fea...
- jsiepkes 2y agoSurprised nobody mentioned JEP 491 [1] yet. Basically it ensures the "synchronized" keyword can no longer mess up virtual threads. That's a big win for running existing code in virtual threads. [1] https://openjdk.org/jeps/491 https://openjdk.org/jeps/491
- deleted 2y ago[deleted]
- guybedo 2y agonice discussion, fwiw i added a structured summary here https://extraakt.com/extraakts/java-24-discussion-features-virtual-threads-and-ecosystem https://extraakt.com/extraakts/java-24-discussion-features-v...