From 50d45c6da927d24d1f86f2e2602e5e688c8ebd40 Mon Sep 17 00:00:00 2001 From: Rob Bygrave Date: Wed, 17 Aug 2022 15:21:16 +1200 Subject: [PATCH] Just use String.intern() now that we are on min Java 11 runtime. --- .../server/core/InternString.java | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/InternString.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/InternString.java index 8a06fc4d4..dadfdb368 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/core/InternString.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/InternString.java @@ -1,38 +1,14 @@ package io.ebeaninternal.server.core; -import java.util.HashMap; -import java.util.concurrent.locks.ReentrantLock; - /** * Used to reduce memory consumption of strings used in deployment processing. - *

- * Using this for now instead of String.intern() to avoid any unexpected - * increase in PermGen space. */ public final class InternString { - private static final HashMap map = new HashMap<>(); - - private static final ReentrantLock lock = new ReentrantLock(); - /** * Return the shared instance of this string. */ public static String intern(String s) { - if (s == null) { - return null; - } - lock.lock(); - try { - String v = map.get(s); - if (v != null) { - return v; - } else { - map.put(s, s); - return s; - } - } finally { - lock.unlock(); - } + return s == null ? null : s.intern(); } }