AbstractScriptPool

abstract class AbstractScriptPool<T : AbstractScript>(val size: Int, nullGlobalContext: Boolean)

Abstract base class for a pool of AbstractScript instances.

Uses a coroutine Channel as a bounded buffer to manage script engine instances. When a script is returned to the pool, its context is automatically reset. Subclasses are responsible for populating the pool in their init block.

Parameters

size

the number of script instances in the pool

nullGlobalContext

if true, resets the global scope bindings to null when recycling

Type Parameters

T

the concrete type of AbstractScript managed by this pool

Constructors

Link copied to clipboard
constructor(size: Int, nullGlobalContext: Boolean)

Properties

Link copied to clipboard

Returns true if there are no script instances currently available in the pool.

Link copied to clipboard
val size: Int

Functions

Link copied to clipboard
suspend fun <R> eval(block: T.() -> R): R