Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2012-09-11 11:26:43 -0400
committerGlyn Normington2012-09-11 11:26:43 -0400
commit60e73f302ba372d4e403d05533893951c268f8ef (patch)
tree51c5ca62a65ecb68a2f93804109efd29d66d0985
parent347bb9d447855fa114a538a18dfea8a68c5e0cee (diff)
downloadorg.eclipse.virgo.medic-60e73f302ba372d4e403d05533893951c268f8ef.tar.gz
org.eclipse.virgo.medic-60e73f302ba372d4e403d05533893951c268f8ef.tar.xz
org.eclipse.virgo.medic-60e73f302ba372d4e403d05533893951c268f8ef.zip
389267: avoid memory leak
-rw-r--r--org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/impl/LoggingPrintStreamWrapper.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/impl/LoggingPrintStreamWrapper.java b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/impl/LoggingPrintStreamWrapper.java
index fd4b144..62c0383 100644
--- a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/impl/LoggingPrintStreamWrapper.java
+++ b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/impl/LoggingPrintStreamWrapper.java
@@ -30,6 +30,14 @@ import org.slf4j.LoggerFactory;
*/
public final class LoggingPrintStreamWrapper extends PrintStream {
+ private static final class StringBuilderThreadLocal extends ThreadLocal<StringBuilder> {
+
+ @Override
+ public StringBuilder initialValue() {
+ return new StringBuilder();
+ }
+ }
+
private static final String LOGBACK_PACKAGE_NAME_PREFIX = "ch.qos.logback";
private final ThreadLocal<StringBuilder> entryBuilders;
@@ -68,12 +76,7 @@ public final class LoggingPrintStreamWrapper extends PrintStream {
this.executionStackAccessor = executionStackAccessor;
- this.entryBuilders = new ThreadLocal<StringBuilder>() {
- @Override
- public StringBuilder initialValue() {
- return new StringBuilder();
- }
- };
+ this.entryBuilders = new StringBuilderThreadLocal();
this.configurationProvider = configurationProvider;

Back to the top