Over at HikariCP we're looking out a little over the horizon at adding support for asynchronous connection acquisition from the pool. We're currently in the midst of a release (2.3.0), but possibly targeting next (or next next) release if we do indeed add support for this.
Our question is this. From an API perspective, what is the easiest consumable way to expose asynchronicity? Understanding that HikariCP is written in Java and not Scala, we see two possibilities. First, an API call to DataSource.getConnection() could return a Future. This of course requires "polling" or "waiting" for the client to obtain the Connection. Second, an API to DataSource.getConnection() could provide a callback (implementation of a callback interface). This would seem more truly asynchronous, being more of a "push" than a "pull". We'd rather pick one rather than implement multiple, because that's how we roll. Keep it simple.
Is there a third option we are overlooking? Which one is preferable? While HikariCP supports Java 6/7 and through a separate artifact Java 8, we are perfectly willing to limit this feature to Java 8 if taking advantage of some of the new constructs (java.util.Optional, java.util.function.Function, etc.) makes it easy/better/natural/forward-looking.