diff --git a/runtime/engine/src/main/java/io/aklivity/zilla/runtime/engine/internal/registry/EngineManager.java b/runtime/engine/src/main/java/io/aklivity/zilla/runtime/engine/internal/registry/EngineManager.java index 4d8da63eff..425f9d5113 100644 --- a/runtime/engine/src/main/java/io/aklivity/zilla/runtime/engine/internal/registry/EngineManager.java +++ b/runtime/engine/src/main/java/io/aklivity/zilla/runtime/engine/internal/registry/EngineManager.java @@ -421,20 +421,20 @@ private void unregister( private final class NameResolver { private final int namespaceId; - private final Matcher matchName; + private final ThreadLocal matchName; private NameResolver( int namespaceId) { this.namespaceId = namespaceId; - this.matchName = NamespaceAdapter.PATTERN_NAME.matcher(""); + this.matchName = ThreadLocal.withInitial(() -> NamespaceAdapter.PATTERN_NAME.matcher("")); } private long resolve( String name) { long id = 0L; - + Matcher matchName = this.matchName.get(); if (name != null && matchName.reset(name).matches()) { String ns = matchName.group("namespace"); @@ -445,7 +445,6 @@ private long resolve( id = NamespacedId.id(nsid, nid); } - return id; }