From c58a316437bc9b2772c133857c8352e29f03bddf Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Tue, 5 Aug 2014 13:32:40 -0700 Subject: [PATCH] Need more synchronizing in DruidDataSource. --- .../java/io/druid/client/DruidDataSource.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/server/src/main/java/io/druid/client/DruidDataSource.java b/server/src/main/java/io/druid/client/DruidDataSource.java index ab6ba436551..9b68daf7ad3 100644 --- a/server/src/main/java/io/druid/client/DruidDataSource.java +++ b/server/src/main/java/io/druid/client/DruidDataSource.java @@ -114,19 +114,23 @@ public class DruidDataSource @Override public String toString() { - return "DruidDataSource{" + - "properties=" + properties + - ", partitions=" + segmentsHolder.toString() + - '}'; + synchronized (lock) { + return "DruidDataSource{" + + "properties=" + properties + + ", partitions=" + segmentsHolder.toString() + + '}'; + } } public ImmutableDruidDataSource toImmutableDruidDataSource() { - return new ImmutableDruidDataSource( - name, - ImmutableMap.copyOf(properties), - ImmutableMap.copyOf(partitionNames), - ImmutableSet.copyOf(segmentsHolder) - ); + synchronized (lock) { + return new ImmutableDruidDataSource( + name, + ImmutableMap.copyOf(properties), + ImmutableMap.copyOf(partitionNames), + ImmutableSet.copyOf(segmentsHolder) + ); + } } }