Pool

io.github.andrebeat.pool.Pool
See thePool companion trait
object Pool

Object containing factory methods for io.github.andrebeat.pool.Pool.

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Pool.type

Members list

Type members

Classlikes

class ClosedPoolException extends Exception

An exception that is thrown when trying to use a closed pool.

An exception that is thrown when trying to use a closed pool.

Attributes

Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def apply[A <: AnyRef](capacity: Int, factory: () => A, referenceType: ReferenceType, maxIdleTime: Duration, reset: A => Unit, dispose: A => Unit, healthCheck: A => Boolean): Pool[A]

Creates a new io.github.andrebeat.pool.ExpiringPool or io.github.andrebeat.pool.SimplePool instance depending on whether a non-zero and finite maxIdleTime is set or not.

Creates a new io.github.andrebeat.pool.ExpiringPool or io.github.andrebeat.pool.SimplePool instance depending on whether a non-zero and finite maxIdleTime is set or not.

Value parameters

capacity

the maximum capacity of the pool

dispose

the function used to destroy an object from the pool

factory

the function used to create new objects in the pool

healthCheck

the predicate used to test whether an object is healthy and should be used, or destroyed otherwise.

maxIdleTime

the maximum amount of the time that objects are allowed to idle in the pool before being evicted

referenceType

the reference type of objects in the io.github.andrebeat.pool.Pool. io.github.andrebeat.pool.ReferenceType.Soft and io.github.andrebeat.pool.ReferenceType.Weak reference are eligible for collection by the GC

reset

the function used to reset objects in the pool (called when leasing an object from the pool)

Attributes

Returns

a new instance of io.github.andrebeat.pool.Pool.