I’m working on Clojure bindings for FoundationDB, which means I’m using the Java API. Some things are unclear to me even after looking at the source code and reading the documentation, so I thought I’d ask and make sure:
- Do I understand correctly that if I call
forEach
on theAsyncIterable
, I can expect to get a callback whenever an item becomes available, without tying up the FDB Java API? - Is there a better way to achieve the same thing (get a callback for each item becoming available)?
- What if my callback function blocks because of backpressure? Is that something that the FDB API expects?
- Calling
open
on anFDB
instance will return aDatabase
object. Is this object intended to be shared by all threads within the application? Will the underlying networking code “do the right thing”? - Assuming I do not perform my own blocking operations in transactions, do I need to worry about thread pool size and the potential for deadlocks from thread pool exhaustion if multiple long-running operations are launched?