dev.pellet.server.buffer.AlwaysAllocatingPelletBufferPool.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pellet-server Show documentation
Show all versions of pellet-server Show documentation
An opinionated Kotlin web framework, with best-practices built-in
package dev.pellet.server.buffer
import java.nio.ByteBuffer
import java.util.concurrent.atomic.AtomicBoolean
class AlwaysAllocatingPelletBufferPool(
private val allocationSize: Int
) : PelletBufferPooling {
override fun provide(): PelletBuffer {
val buffer = ByteBuffer.allocate(allocationSize)
return PelletBuffer(
buffer,
used = AtomicBoolean(true)
)
}
override fun release(buffer: PelletBuffer) {
buffer.used.set(false)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy