r/java • u/GavinRayDev • Jan 16 '23
Building a PostgreSQL Wire Protocol Server using Vanilla, Modern Java 21 (shows use of: Records, Sealed Types, Pattern Matching for Switch, Virtual Threads, and Panama FFM)
https://gavinray97.github.io/blog/postgres-wire-protocol-jdk-21
224
Upvotes
7
u/GavinRayDev Jan 16 '23
No particular reason, outside of the fact that I tried to write it originally with an async socket for performance, couldn't find any good examples online:
https://www.google.com/search?q=java+AsynchronousSocketChannel+example
There's one article which shows some super basic usage and then a bunch of regurgitated articles with questionable code patterns
So I did some digging in Github for usages of the API and tried to put something together that was a bit more full-fledged. Now there exists a better reference article for it.
I'm not familiar enough with the internals of Loom to know whether the Virtual Threads make a huge impact in this async context (maybe /u/pron98 can comment) but I had thought that since it's used for the channel group executor service it should be alright.