Skip to content

Commit

Permalink
Replace val with fun to fix init order (#3158)
Browse files Browse the repository at this point in the history
  • Loading branch information
e5l authored Sep 6, 2022
1 parent 60b9269 commit 3e64f99
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package io.ktor.http.cio.internals

import io.ktor.utils.io.pool.*

internal expect val DISABLE_CHAR_ARRAY_POOLING: Boolean
internal expect fun isPoolingDisabled(): Boolean

internal const val CHAR_ARRAY_POOL_SIZE = 4096

Expand All @@ -15,7 +15,7 @@ internal const val CHAR_ARRAY_POOL_SIZE = 4096
*/
internal const val CHAR_BUFFER_ARRAY_LENGTH: Int = 4096 / 2

internal val CharArrayPool: ObjectPool<CharArray> = if (DISABLE_CHAR_ARRAY_POOLING) {
internal val CharArrayPool: ObjectPool<CharArray> = if (isPoolingDisabled()) {
object : NoPoolImpl<CharArray>() {
override fun borrow(): CharArray {
return CharArray(CHAR_BUFFER_ARRAY_LENGTH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

package io.ktor.http.cio.internals

internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean = false
internal actual fun isPoolingDisabled(): Boolean = false
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

package io.ktor.http.cio.internals

internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean =
internal actual fun isPoolingDisabled(): Boolean =
System.getProperty("ktor.internal.cio.disable.chararray.pooling")?.toBoolean() ?: false
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

package io.ktor.http.cio.internals

internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean = false
internal actual fun isPoolingDisabled(): Boolean = false

0 comments on commit 3e64f99

Please sign in to comment.