pool

Generated by tinox doc

tinox.core.pool, bundled with the compiler and also available as a standalone tinox-central package.

Object pool

import tinox.core.pool
class Main
{
    fnc main() -> Int32
    {
        const connections: Pool<String> = Pool<String>::newWithFactory(5, \-> "new-connection")
        const c1: String = Pool::acquire(connections)
        println("acquired: " + c1)
        Pool::release(connections, c1)
        return 0
    }
}

class Pool<T>

Fields

availableList<T>
inUseList<T>
maxSizeInt64
factoryfnc() -> T

Methods

fn new(maxSize: Int64) → Pool<T>
fn newWithFactory(maxSize: Int64, factory: fnc() -> T) → Pool<T>
@Throwsfn acquire(pool: Pool<T>) → T
fn release(pool: Pool<T>, obj: T) → Nothing
fn clear(pool: Pool<T>) → Nothing

@Errorclass PoolExhaustedError

* The pool has no free resource.

Fields

messageString