From 07d630de5ab28bea68f466a4cf1dc19dce300a33 Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Mon, 3 Mar 2014 00:03:43 +0900 Subject: [PATCH] #39 Get rid of anonymous inner class in ThreadLocal as it might possibly trigger a warning in Tomcat. --- .../com/zaxxer/hikari/util/ConcurrentBag.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java b/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java index ee43276e..75331544 100644 --- a/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java +++ b/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java @@ -74,12 +74,7 @@ public class ConcurrentBag(); this.synchronizer = new Synchronizer(); - this.threadList = new ThreadLocal>() { - protected LinkedList initialValue() - { - return new LinkedList<>(); - } - }; + this.threadList = new ThreadLocal>(); } /** @@ -94,7 +89,13 @@ public class ConcurrentBag list = threadList.get(); + LinkedList list = threadList.get(); + if (list == null) + { + list = new LinkedList<>(); + threadList.set(list); + } + while (!list.isEmpty()) { final T reference = list.removeFirst();