public final class BytesPool extends Object
Bytes instances.
This class uses a ThreadLocal to store a single Bytes instance per thread,
which can be reused to avoid the overhead of creating a new instance every time bytes are
needed for operations.
This class is primarily meant to be used in high-performance environments where reducing object creation is crucial.
| Constructor and Description |
|---|
BytesPool()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
Bytes<?> |
acquireBytes()
Deprecated.
Use
createThreadLocal() and ScopedResourcePool.get() instead |
static net.openhft.chronicle.core.scoped.ScopedResourcePool<Bytes<?>> |
createThreadLocal()
Create a scoped-thread-local pool of bytes resources
|
static net.openhft.chronicle.core.scoped.ScopedResourcePool<Bytes<?>> |
createThreadLocal(int instancesPerThread)
Create a scoped-thread-local pool of bytes resources
|
@Deprecated public BytesPool()
public static net.openhft.chronicle.core.scoped.ScopedResourcePool<Bytes<?>> createThreadLocal()
public static net.openhft.chronicle.core.scoped.ScopedResourcePool<Bytes<?>> createThreadLocal(int instancesPerThread)
instancesPerThread - The maximum number of instances to retain per thread@Deprecated public Bytes<?> acquireBytes()
createThreadLocal() and ScopedResourcePool.get() insteadBytes instance from the thread-local pool. If the pool does not
contain a Bytes instance for the current thread, a new one is created and
added to the pool.Bytes instance.Copyright © 2023. All rights reserved.