From d362e6d5947492d4f1840953c5f4a9e107ea8dd9 Mon Sep 17 00:00:00 2001 From: lordchen1020 <1572139390@qq.com> Date: Thu, 14 Oct 2021 21:05:54 +0800 Subject: [PATCH] When using regular expressions, make good use of its pre-compilation function, which can effectively speed up the regular table matching speed --- .../apache/bookkeeper/tests/integration/utils/DockerUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/DockerUtils.java b/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/DockerUtils.java index 415c1b3e373..867377f51bf 100644 --- a/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/DockerUtils.java +++ b/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/DockerUtils.java @@ -52,6 +52,7 @@ */ public class DockerUtils { private static final Logger LOG = LoggerFactory.getLogger(DockerUtils.class); + private static final Pattern pattern = Pattern.compile("^arq.cube.docker.([^.]*).ip$"); private static File getTargetDirectory(String containerId) { String base = System.getProperty("maven.buildDirectory"); @@ -223,7 +224,6 @@ public void onComplete() { } public static Set cubeIdsMatching(String needle) { - Pattern pattern = Pattern.compile("^arq.cube.docker.([^.]*).ip$"); return System.getProperties().keySet().stream() .map(k -> pattern.matcher(k.toString())) .filter(m -> m.matches())