File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
zio-kafka/src/main/scala/zio/kafka/consumer/internal Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -9,16 +9,18 @@ private[consumer] object RunloopExecutor {
9
9
10
10
private val counter : AtomicLong = new AtomicLong (0 )
11
11
12
- private def newSingleThreadedExecutor ( i : Long ) : ZIO [Scope , Throwable , Executor ] =
12
+ private val newSingleThreadedExecutor : ZIO [Scope , Throwable , Executor ] =
13
13
ZIO .acquireRelease {
14
14
ZIO .attempt {
15
15
val javaExecutor =
16
- Executors .newSingleThreadExecutor(runnable => new Thread (runnable, s " zio-kafka-runloop-thread- $i" ))
16
+ Executors .newSingleThreadExecutor { runnable =>
17
+ new Thread (runnable, s " zio-kafka-runloop-thread- ${counter.getAndIncrement()}" )
18
+ }
17
19
18
20
Executor .fromJavaExecutor(javaExecutor) -> javaExecutor
19
21
}
20
22
} { case (_, executor) => ZIO .attempt(executor.shutdown()).orDie }.map(_._1)
21
23
22
- val newInstance : ZIO [Scope , Throwable , Executor ] = newSingleThreadedExecutor(counter.getAndIncrement())
24
+ val newInstance : ZIO [Scope , Throwable , Executor ] = newSingleThreadedExecutor
23
25
24
26
}
You can’t perform that action at this time.
0 commit comments