Skip to content

Commit 2f7e9e0

Browse files
committed
chore: Avoid forwarding method on ArrayDequeue in BatchingExecutor.
1 parent c953f50 commit 2f7e9e0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

actor/src/main/scala/org/apache/pekko/dispatch/BatchingExecutor.scala

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package org.apache.pekko.dispatch
1616
import org.apache.pekko
1717
import pekko.annotation.InternalApi
1818

19-
import java.util.ArrayDeque
2019
import java.util.concurrent.Executor
2120
import scala.annotation.tailrec
2221
import scala.concurrent._
@@ -67,10 +66,10 @@ private[pekko] trait BatchingExecutor extends Executor {
6766
// invariant: if "_tasksLocal.get ne null" then we are inside Batch.run; if it is null, we are outside
6867
private[this] val _tasksLocal = new ThreadLocal[AbstractBatch]()
6968

70-
private[this] abstract class AbstractBatch extends ArrayDeque[Runnable](4) with Runnable {
69+
private[this] abstract class AbstractBatch extends java.util.ArrayDeque[Runnable](4) with Runnable {
7170
@tailrec final def processBatch(batch: AbstractBatch): Unit =
7271
if ((batch eq this) && !batch.isEmpty) {
73-
batch.poll().run()
72+
batch.pollFirst().run()
7473
processBatch(_tasksLocal.get) // If this is null, then we have been using managed blocking, so bail out
7574
}
7675

@@ -85,7 +84,7 @@ private[pekko] trait BatchingExecutor extends Executor {
8584
}
8685

8786
private[this] final class Batch extends AbstractBatch {
88-
override final def run: Unit = {
87+
override final def run(): Unit = {
8988
require(_tasksLocal.get eq null)
9089
_tasksLocal.set(this) // Install ourselves as the current batch
9190
try processBatch(this)

0 commit comments

Comments
 (0)