Skip to content

Commit

Permalink
Merge pull request #41 from spand/pr/threadnaming
Browse files Browse the repository at this point in the history
Bind pool number and thread counter instead of globally for DefaultEx…
  • Loading branch information
cy6erGn0m committed Sep 13, 2016
2 parents 24d5a1d + d0d0b7f commit 011e86a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ class ApplicationEnvironmentBuilder : ApplicationEnvironment {
}

private val poolCounter = AtomicInteger()
private val threadCounter = AtomicInteger()
internal val DefaultExecutorServiceBuilder = {
val pool: Int = poolCounter.incrementAndGet()
val threadCounter = AtomicInteger()
Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors(), { r ->
Thread(r, "ktor-pool-${poolCounter.incrementAndGet()}-thread-${threadCounter.incrementAndGet()}")
})!!
Thread(r, "ktor-pool-$pool-thread-${threadCounter.incrementAndGet()}")
})
}

0 comments on commit 011e86a

Please sign in to comment.