Asynchronous JDBC
For example, can ormlite adapt to working with this library: https://github.com/jasync-sql/jasync-sql
But in general, how much work would it take to transform the library to both sync and async?
Hrm. Interesting. The idea is to have a thread pool and return futures for any operations that block?
Well, that's one way to do it since the current JDBC blocks.
Another way I thought about would be a combination of a thread pool and query queue. Although there will be limited number of threads (maybe per CPU threads), the query queue can grow to include thousands of queries.
And of course, there are Kotlin's coroutines -- could be also adapted to work in Java.
Finally, Oracle talked about ADBA back in 2016 (https://github.com/oracle/oracle-db-examples/tree/master/java/AoJ) so I suppose asynchronousity is, or will be, a reality soon enough.
Coroutines are a great way to tackle this issue, I think, and luckily there's a pure Java implementation for it: https://github.com/esoco/coroutines
I really don't want to add that as a dependency @noordawod . Is there something we can do to simulate it? What are the pattern(s) that we are trying to support?
If not coroutines, then I guess an Executor with a query queue. It should be straightforward as the existing code doesn't change, but we add a new ormlite-jdbc-async that orchestrates the asynchronousity. What do you think?
About patterns: I would say callback-based pattern at this point, the easiest.