Live data from Hacker News

Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

infoq.com

251–260 of 555 posts

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#251
post #201

`Executors.newVirtualThreadPerTaskExecutor()`. Java verbosity is alive and well.

Given this is something you're probably going to find at most a handful of times in an entire code base, I don't think that's necessarily bad.

Java API stuff hasn't ever been a huge contributor to verbose code. Yeah I guess some of java.io's stuff isn't great, but the worst AbstractFactoryDelegateImplFacadeProviderVisitor gore was always in the application code.

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#252
post #148
post #130

Earlier quoted context omitted.

What is the virtual thread feature in .NET called? I can't find any information about it.

Tasks, simple intro here https://code-maze.com/csharp-tasks-vs-threads/

I don't think this is the same thing. As far as I can tell, the task abstraction is a threapool where you can submit operations and return futures. If a task blocks indefinitely, the underlying threadpool OS worker thread will be blocked, and the threadpool either has to run with less resources or spawn a new worker. Virtual threads are an M:N abstraction: blocking on a virtual thread will not block the underlying OS thread.

.NET might indeed have a virtual thread abstraction and if it does you could of course implement the Task abstraction on top of either virtual threads or OS threads, but what you linked to is not a proof that it does.

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#253
post #201

`Executors.newVirtualThreadPerTaskExecutor()`. Java verbosity is alive and well.

So is Apple/Swift, but Apple always gets a smile instead of a smirk here on HN. func CMMetadataFormatDescriptionCreateWithMetadataFormatDescriptionAndMetadataSpecifications( allocator: CFAllocator?, sourceDescription: CMMetadataFormatDescription, metadataSpecifications: CFArray, formatDescriptionOut: UnsafeMutablePointer ) -> OSStatus

Wow. Where did you find that specimen?

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#254
post #73

> Virtual threads offer a more efficient alternative to platform threads, allowing developers to handle a large number of tasks with significantly lower overhead. they should have just called them "Tasks" leaving the already overloaded term "virtual" out of the conversation.

Java's already got tasks[1] within the namespace of parallelism though, but it hasn't overloaded any meaning onto virtual.

[1] https://docs.oracle.com/javase/9/docs/api/index.html?javafx/...

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#255
post #10

So with this, the last thing Go had going for it over Java is gone, right? Java has an obviously better type system, while Java originated the billion dollar mistake, Java also at this point has much better practices around handling nulls than Go, Java's jars are more portable than go's binaries, Java's GC performs better, Java has a more mature ecosystem and more libraries... Java has better IDE support and comparab…

> Java's jars are more portable than go's binaries Since when?

Since forever.

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#256
post #201

`Executors.newVirtualThreadPerTaskExecutor()`. Java verbosity is alive and well.

So is Apple/Swift, but Apple always gets a smile instead of a smirk here on HN. func CMMetadataFormatDescriptionCreateWithMetadataFormatDescriptionAndMetadataSpecifications( allocator: CFAllocator?, sourceDescription: CMMetadataFormatDescription, metadataSpecifications: CFArray, formatDescriptionOut: UnsafeMutablePointer ) -> OSStatus

Do they? I recall ObjC getting a lot of criticism over their long method names.

But really, who cares? Who the hell types out the whole method in this day and age? Type the first few chars, up arrow, down arrow, tab. Jump around with vi bindings. I have not written a full line of code in well over a decade.

Although Apple deserves it since their IDE really blows compared to say Idea.

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#257

Earlier quoted context omitted.

I have my complaints about Spring, but bad docs is definitely not among them. What do you consider a good docs?

Django's docs are great. For Spring, Google tends to bring up random sites with dubious quality content.

You know there’s official Spring docs, right? You’re complaining that Googling for something shows links to random blogs and Stackoverflow questions. That’s not exactly a phenomenon unique to Spring.

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#258
post #22

Earlier quoted context omitted.

Irrational Fear of Java is one of the most confusing things among startup stage companies.

Sysadmin here. It's true Java still smells like "corporate" and "slow". And when I say "slow", I don't mean the runtime speed, but the company speed ;) Until not a long time ago I've been maintaining a bunch of Sun|Oracle|J9 Java 6 + JBoss 4.2.3 + AIX|Linux + PPC|x86_64 ... That was not fun, and the task of moving it to more modern platforms was insurmountable to us. No wonder Azul has support for Java 6 until 2027.…

Yeah fair. Old JVM land and Modern JVM land really are worlds apart.

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#259
post #176
post #10

So with this, the last thing Go had going for it over Java is gone, right? Java has an obviously better type system, while Java originated the billion dollar mistake, Java also at this point has much better practices around handling nulls than Go, Java's jars are more portable than go's binaries, Java's GC performs better, Java has a more mature ecosystem and more libraries... Java has better IDE support and comparab…

As a language java's not that bad at this point. But it still has cultural issues. Every java project I encounter tends to be overengineered, has tons of useless boilerplate code and ends up throwing mile-long stack traces as a result. Also, somehow maven manages to be even more unreliable than npm as a package manager. I still frequently encounter situations which seem to only get resolved by throwing away my .m2 fo…

> There's at least 6 different ways to iterate over map values. Which one should I pick?

Didn't stop people from using Javascript.

> I still frequently encounter situations which seem to only get resolved by throwing away my .m2 folder

And I frequently encounter issues which seem to only get resolved by throwing away my node_modules folder (and package-lock.json).

Point being every language has its issues but Java gets knocked down constantly regardless.

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#260
post #106

Earlier quoted context omitted.

Based on your writing, your experience with Java is indeed very limited and not up-to-date at all.

It's simply that the average Java project is out of date and not worth updating, which says a lot.

As in works just fine and generates business value despite not being touched in years? Yes, says a lot.
Post reply on HN