KryoPool.Builder| Modifier and Type | Field and Description |
|---|---|
private KryoFactory |
factory |
private java.util.Queue<Kryo> |
queue |
| Constructor and Description |
|---|
KryoPoolQueueImpl(KryoFactory factory,
java.util.Queue<Kryo> queue) |
| Modifier and Type | Method and Description |
|---|---|
Kryo |
borrow()
Takes a
Kryo instance from the pool or creates a new one
(using the factory) if the pool is empty. |
void |
clear() |
void |
release(Kryo kryo)
Returns the given
Kryo instance to the pool. |
<T> T |
run(KryoCallback<T> callback)
Runs the provided
KryoCallback with a Kryo instance
from the pool (borrow/release around KryoCallback.execute(Kryo)). |
int |
size() |
private final java.util.Queue<Kryo> queue
private final KryoFactory factory
KryoPoolQueueImpl(KryoFactory factory, java.util.Queue<Kryo> queue)
public int size()
public Kryo borrow()
KryoPoolKryo instance from the pool or creates a new one
(using the factory) if the pool is empty.public void release(Kryo kryo)
KryoPoolKryo instance to the pool.public <T> T run(KryoCallback<T> callback)
KryoPoolKryoCallback with a Kryo instance
from the pool (borrow/release around KryoCallback.execute(Kryo)).public void clear()