All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.pellet.server.buffer.AlwaysAllocatingPelletBufferPool.kt Maven / Gradle / Ivy

There is a newer version: 0.0.16
Show newest version
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