rxjava2-jdbc icon indicating copy to clipboard operation
rxjava2-jdbc copied to clipboard

Enhance non-blocking connection pool

Open davidmoten opened this issue 8 years ago • 6 comments

Just to mention I'll rewrite portions of the MemberSingle drain loop and NonBlockingConnectionPool to maximize non-blocking. At the moment establishment of a connection blocks the drain loop. It should be scheduled with a subsequent drain call. Might get to release stage in a week or two.

davidmoten avatar Oct 01 '17 08:10 davidmoten

Hi David the method connections() on the Database returns a Single<Connection>. Is this Right? I would have have thought if a Database object was created via NonBlockingConnectionPool then surely you would have a pool of connections thus method would return a Flowable<Connection>. If i am wrong can you pleas clarify? Thanks.

adam-mahmood avatar Oct 06 '17 16:10 adam-mahmood

Thanks for your question. I should rename that method to connection().

I don't have a use case for a Flowable<Connection>, a Single<Connection> is all I needed so that design is use-case driven. What's your use case and I'll see if there's a need for Flowable<Connection>?

Be aware that the Single<Connection> is reusable in that each subscription gets a Connection.

Note also that the Single<Connection> can be trivially turned into a Flowable by calling .repeat() but I wouldn't suggest it without discussing the use case first.

davidmoten avatar Oct 07 '17 07:10 davidmoten

Thanks David. I do not have a particular use case, just puzzled by connections(). I can see you have made the change. It would be good if you could add some JavaDocs at some point to the the code.

adam-mahmood avatar Oct 09 '17 08:10 adam-mahmood

drain rework is just about complete and has been merged to master. It includes removal of all blocking code from the MemberSingle.drain() method. I'll add more tests.

davidmoten avatar Oct 14 '17 04:10 davidmoten

Hi David, a quick question do you have support for stored procedures?

adam-mahmood avatar Nov 02 '17 10:11 adam-mahmood

No, not yet. I'll raise an issue and see about getting to it. See #8.

davidmoten avatar Nov 02 '17 23:11 davidmoten