Lazy Pool
constructor(clear: (A) -> Unit? = null, shouldReturnToPool: (A) -> Boolean? = null, bound: Int? = null, newInstance: () -> A)
Parameters
clear
If specified this function will be run on each borrowed instance before handing it over.
should Return To Pool
If specified this function will be run on each release to determine whether the instance should be returned to the pool for reuse. This may be useful for pooled resources that dynamically grow during usage, and we may not want to retain them forever.
bound
If specified the pool will be bounded. Once all instances are borrowed subsequent borrows will block until an instance is released.
new Instance
The function to call to lazily newInstance a pooled resource.