Skip to content

Commit cd466de

Browse files
committed
Enabling performance optimization for synchronous BatchingExecutors
1 parent a23907f commit cd466de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/library/scala/concurrent/BatchingExecutor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ private[concurrent] trait BatchingExecutor extends Executor {
213213
Objects.requireNonNull(runnable, "runnable is null")
214214
val b = _tasksLocal.get
215215
if (b.isInstanceOf[Batch]) b.asInstanceOf[Batch].push(runnable)
216-
else if (b != null) {
216+
else if (b == null) { // If there is null in _tasksLocal, set a marker and run, inflate the Batch only if needed
217217
_tasksLocal.set(BatchingExecutorStatics.marker) // Set a marker to indicate that we are submitting synchronously
218218
runnable.run() // If we observe a non-null task which isn't a batch here, then allocate a batch
219219
_tasksLocal.remove() // Since we are executing synchronously, we can clear this at the end of execution

0 commit comments

Comments
 (0)