This is an automated email from the ASF dual-hosted git repository. shaofengshi pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kylin.git
The following commit(s) were added to refs/heads/master by this push: new 4f3fd2b KYLIN-3556, replace String.intern to avoid unexpected locking collisions 4f3fd2b is described below commit 4f3fd2bc19e0f4f48ce52029d15213c3cdffb687 Author: etherge <ethe...@163.com> AuthorDate: Mon Oct 29 17:39:44 2018 +0800 KYLIN-3556, replace String.intern to avoid unexpected locking collisions --- .../apache/kylin/common/persistence/JDBCResourceDAO.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core-common/src/main/java/org/apache/kylin/common/persistence/JDBCResourceDAO.java b/core-common/src/main/java/org/apache/kylin/common/persistence/JDBCResourceDAO.java index c301d10..54075ff 100644 --- a/core-common/src/main/java/org/apache/kylin/common/persistence/JDBCResourceDAO.java +++ b/core-common/src/main/java/org/apache/kylin/common/persistence/JDBCResourceDAO.java @@ -35,7 +35,6 @@ import java.util.Locale; import java.util.NavigableSet; import java.util.TreeSet; -import com.google.common.base.Preconditions; import org.apache.commons.io.IOUtils; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; @@ -47,6 +46,9 @@ import org.apache.kylin.common.util.HadoopUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.Interner; +import com.google.common.collect.Interners; import com.google.common.collect.Lists; public class JDBCResourceDAO { @@ -72,6 +74,8 @@ public class JDBCResourceDAO { private FileSystem redirectFileSystem; + private Interner<String> interner = Interners.newStrongInterner(); + public JDBCResourceDAO(KylinConfig kylinConfig, String metadataIdentifier) throws SQLException { this.kylinConfig = kylinConfig; this.connectionManager = JDBCConnectionManager.getConnectionManager(); @@ -162,7 +166,8 @@ public class JDBCResourceDAO { return allResourceName; } - private void listResource(final String tableName, final String folderPath, final NavigableSet<String> allResourceName, final boolean recursive) throws SQLException { + private void listResource(final String tableName, final String folderPath, + final NavigableSet<String> allResourceName, final boolean recursive) throws SQLException { executeSql(new SqlOperation() { @Override public void execute(Connection connection) throws SQLException { @@ -280,7 +285,7 @@ public class JDBCResourceDAO { @Override public void execute(Connection connection) throws SQLException { byte[] content = getResourceDataBytes(resource); - synchronized (resource.getPath().intern()) { + synchronized (interner.intern(resource.getPath())) { boolean existing = existResource(resource.getPath()); String tableName = getMetaTableName(resource.getPath()); if (existing) { @@ -331,7 +336,7 @@ public class JDBCResourceDAO { executeSql(new SqlOperation() { @Override public void execute(Connection connection) throws SQLException { - synchronized (resPath.intern()) { + synchronized (interner.intern(resPath)) { String tableName = getMetaTableName(resPath); if (!existResource(resPath)) { if (oldTS != 0) {