Skip to content

Commit

Permalink
Merge pull request #60 from Malinskiy/fix/buffer-pool-jdk8
Browse files Browse the repository at this point in the history
fix(adam): use compatClear in ByteBufferObjectFactory
  • Loading branch information
Malinskiy authored Oct 20, 2021
2 parents b55a7db + 35781d4 commit 6f71fc1
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.malinskiy.adam.transport

import com.malinskiy.adam.Const
import com.malinskiy.adam.extension.compatClear
import org.apache.commons.pool2.PooledObject
import org.apache.commons.pool2.PooledObjectFactory
import org.apache.commons.pool2.impl.DefaultPooledObject
Expand Down Expand Up @@ -47,14 +48,14 @@ class ByteBufferPool(private val poolSize: Int, private val bufferSize: Int) {
class ByteBufferObjectFactory(private val bufferSize: Int) : PooledObjectFactory<ByteBuffer> {
override fun activateObject(p: PooledObject<ByteBuffer>?) {
p?.`object`?.apply {
clear()
compatClear()
order(ByteOrder.BIG_ENDIAN)
}
}

override fun destroyObject(p: PooledObject<ByteBuffer>?) {
p?.`object`?.apply {
clear()
compatClear()
order(ByteOrder.BIG_ENDIAN)
}
}
Expand All @@ -65,7 +66,7 @@ class ByteBufferObjectFactory(private val bufferSize: Int) : PooledObjectFactory

override fun passivateObject(p: PooledObject<ByteBuffer>?) {
p?.`object`?.apply {
clear()
compatClear()
order(ByteOrder.BIG_ENDIAN)
}
}
Expand Down

0 comments on commit 6f71fc1

Please sign in to comment.