2016-05-27 21:58 GMT+02:00 <[email protected]>: > Thanks Lukas. That helps. Curious though, if the JDBC driver doesn't > provide an async I/O API, what is the gain from adding async methods to the > jOOQ API? >
The consistent programming model, and the distant hope that a JDBC 5.0 version will help propagate asynchronicity one more layer down the stack. Of course, given the numerous attempts by the JDK library designers to get concurrency APIs right, we might've bet on the wrong horse once again (as we did before when we supported Future<R> fetchLater()) > Clients can always wrap jOOQ usage in CompletableFuture.supplyAsync(() -> > ...) themselves > Yes, they can. And they could also wrap Results in Streams themselves. And Object[] in Records, if they must. Etc. :) But the gain from a consistent programming model is non negligible, I think. If you're doing these things yourself, you will need to make sure that you will always properly configure your Executors for each call. In that respect, the CompletableFuture API is a bit unfortunate as it always defaults to passing stuff to the ForkJoinPool (jOOQ has a Configuration.executorProvider() SPI to provide the default Executor throughout the CompletionStage chain), and you might not think of wrapping individual blocking operations in a ManagedBlocker in case your runnables do hit the ForkJoinPool. jOOQ does these things for you. That might already be helpful. If not, sure. You can wrap stuff yourself. In that case, I suggest reading this interesting blog post here: https://blog.jooq.org/2015/06/16/querying-your-database-from-millions-of-fibers-rather-than-thousands-of-threads/ > and that would at least not perpetuate the lie. > It wouldn't perpetuate it to your DAO logic which immediately uses jOOQ, but it would most certainly perpetuate it to your service / client logic :) Asynchronicity in RDBMS is a lie (someone, somewhere needs to keep some process waiting on that sweet table/row/cell lock. It's the database). Just like non-serializable transactions are a lie. The latter, we've accepted to live with for several decades. I'm sure we'll accept to live with the former too. Having said so, if you find anything that will help further improve the lie, I'm very happy to discuss! Hope this helps, Lukas -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
