DefaultPool

expect abstract class DefaultPool<T : Any>(capacity: Int) : ObjectPool<T>

Default object pool implementation.

Inheritors

actual abstract class DefaultPool<T : Any>(val capacity: Int) : ObjectPool<T>
actual abstract class DefaultPool<T : Any>(val capacity: Int) : ObjectPool<T>

Inheritors

actual abstract class DefaultPool<T : Any>(val capacity: Int) : ObjectPool<T>

Constructors

Link copied to clipboard
expect constructor(capacity: Int)
actual constructor(capacity: Int)
actual constructor(capacity: Int)
actual constructor(capacity: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
expect override val capacity: Int

Pool capacity.

actual override val capacity: Int

Pool capacity

actual override val capacity: Int

Pool capacity

actual override val capacity: Int

Pool capacity

Link copied to clipboard
Link copied to clipboard
val inUsed: Int
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
expect override fun borrow(): T

borrow an instance. Pool can recycle an old instance or create a new one

actual override fun borrow(): T

borrow an instance. Pool can recycle an old instance or create a new one

actual override fun borrow(): T

borrow an instance. Pool can recycle an old instance or create a new one

actual override fun borrow(): T

borrow an instance. Pool can recycle an old instance or create a new one

Link copied to clipboard
open override fun close()

Does pool dispose

open override fun close()

Does pool dispose

open override fun close()

Does pool dispose

open override fun close()

Does pool dispose

Link copied to clipboard
expect override fun dispose()

Dispose the whole pool. None of borrowed objects could be used after the pool gets disposed otherwise it can result in undefined behaviour

actual override fun dispose()

Dispose the whole pool. None of borrowed objects could be used after the pool gets disposed otherwise it can result in undefined behaviour

actual override fun dispose()

Dispose the whole pool. None of borrowed objects could be used after the pool gets disposed otherwise it can result in undefined behaviour

actual override fun dispose()

Dispose the whole pool. None of borrowed objects could be used after the pool gets disposed otherwise it can result in undefined behaviour

Link copied to clipboard
expect override fun recycle(instance: T)

Recycle an instance. Should be recycled what was borrowed before otherwise could fail

actual override fun recycle(instance: T)

Recycle an instance. Should be recycled what was borrowed before otherwise could fail

actual override fun recycle(instance: T)

Recycle an instance. Should be recycled what was borrowed before otherwise could fail

actual override fun recycle(instance: T)

Recycle an instance. Should be recycled what was borrowed before otherwise could fail

Link copied to clipboard
inline fun <T : Any, R> ObjectPool<T>.useBorrowed(block: (T) -> R): R

Borrows and instance of T from the pool, invokes block with it and finally recycles it

Link copied to clipboard
inline fun <T : Any, R> ObjectPool<T>.useInstance(block: (T) -> R): R

Borrows and instance of T from the pool, invokes block with it and finally recycles it