AbstractEnginePool
Abstract base class for a fixed-size pool of script engines, shared by AbstractScriptPool and AbstractExprEvaluatorPool.
Uses a coroutine Channel as a bounded buffer of instances. Subclasses create the instances with populate in their init block, borrow one with withInstance, and prepare a returned instance for its next borrower in reset. An instance handed to a borrower that is cancelled before it resumes goes back into the pool instead of being lost. Closing the pool closes its instances.
Parameters
size
the number of instances in the pool; must be positive
Type Parameters
T
the type of engine in the pool
Throws
if size is not positive