From 9b9d0d1559787fc7e2f63f609813904b3c857873 Mon Sep 17 00:00:00 2001 From: Justin King Date: Thu, 17 Oct 2024 12:13:53 -0700 Subject: [PATCH] Use an immutable copy of `DefaultDispatcher` to avoid synchronization PiperOrigin-RevId: 687000721 --- .../src/main/java/dev/cel/runtime/CelRuntimeLegacyImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/src/main/java/dev/cel/runtime/CelRuntimeLegacyImpl.java b/runtime/src/main/java/dev/cel/runtime/CelRuntimeLegacyImpl.java index f5f96e5c..81beec7c 100644 --- a/runtime/src/main/java/dev/cel/runtime/CelRuntimeLegacyImpl.java +++ b/runtime/src/main/java/dev/cel/runtime/CelRuntimeLegacyImpl.java @@ -266,7 +266,9 @@ public CelRuntimeLegacyImpl build() { } return new CelRuntimeLegacyImpl( - new DefaultInterpreter(runtimeTypeProvider, dispatcher, options), options, this); + new DefaultInterpreter(runtimeTypeProvider, dispatcher.immutableCopy(), options), + options, + this); } private static CelDescriptorPool newDescriptorPool(