take/return kryo no longer need to suspend
This commit is contained in:
parent
7df974ce40
commit
345de4d734
|
@ -80,12 +80,12 @@ interface NetworkSerializationManager : SerializationManager<DirectBuffer> {
|
|||
/**
|
||||
* @return takes a kryo instance from the pool.
|
||||
*/
|
||||
suspend fun takeKryo(): KryoExtra
|
||||
fun takeKryo(): KryoExtra
|
||||
|
||||
/**
|
||||
* Returns a kryo instance to the pool.
|
||||
*/
|
||||
suspend fun returnKryo(kryo: KryoExtra)
|
||||
fun returnKryo(kryo: KryoExtra)
|
||||
|
||||
/**
|
||||
* @return true if the remote kryo registration are the same as our own
|
||||
|
|
|
@ -555,7 +555,7 @@ class Serialization(private val references: Boolean,
|
|||
/**
|
||||
* @return takes a kryo instance from the pool.
|
||||
*/
|
||||
override suspend fun takeKryo(): KryoExtra {
|
||||
override fun takeKryo(): KryoExtra {
|
||||
// ALWAYS get as many as needed. Recycle them to prevent too many getting created
|
||||
return kryoPool.poll() ?: initKryo()
|
||||
}
|
||||
|
@ -563,8 +563,9 @@ class Serialization(private val references: Boolean,
|
|||
/**
|
||||
* Returns a kryo instance to the pool for use later on
|
||||
*/
|
||||
override suspend fun returnKryo(kryo: KryoExtra) {
|
||||
kryoPool.send(kryo)
|
||||
override fun returnKryo(kryo: KryoExtra) {
|
||||
// return as much as we can. don't suspend if the pool is full, we just throw it away.
|
||||
kryoPool.offer(kryo)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user