Package com.esotericsoftware.kryo.pool
Class KryoPoolQueueImpl
- java.lang.Object
-
- com.esotericsoftware.kryo.pool.KryoPoolQueueImpl
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.esotericsoftware.kryo.pool.KryoPool
KryoPool.Builder
-
-
Field Summary
Fields Modifier and Type Field Description private KryoFactory
factory
private java.util.Queue<Kryo>
queue
-
Constructor Summary
Constructors Constructor Description KryoPoolQueueImpl(KryoFactory factory, java.util.Queue<Kryo> queue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Kryo
borrow()
Takes aKryo
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 givenKryo
instance to the pool.<T> T
run(KryoCallback<T> callback)
Runs the providedKryoCallback
with aKryo
instance from the pool (borrow/release aroundKryoCallback.execute(Kryo)
).int
size()
-
-
-
Field Detail
-
queue
private final java.util.Queue<Kryo> queue
-
factory
private final KryoFactory factory
-
-
Constructor Detail
-
KryoPoolQueueImpl
KryoPoolQueueImpl(KryoFactory factory, java.util.Queue<Kryo> queue)
-
-
Method Detail
-
size
public int size()
-
borrow
public Kryo borrow()
Description copied from interface:KryoPool
Takes aKryo
instance from the pool or creates a new one (using the factory) if the pool is empty.
-
release
public void release(Kryo kryo)
Description copied from interface:KryoPool
Returns the givenKryo
instance to the pool.
-
run
public <T> T run(KryoCallback<T> callback)
Description copied from interface:KryoPool
Runs the providedKryoCallback
with aKryo
instance from the pool (borrow/release aroundKryoCallback.execute(Kryo)
).
-
clear
public void clear()
-
-