You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Ian Hu (JIRA)" <ji...@apache.org> on 2018/08/21 09:22:00 UTC

[jira] [Created] (KYLIN-3505) DataType.getType wrong usage of cache

Ian Hu created KYLIN-3505:
-----------------------------

             Summary: DataType.getType wrong usage of cache
                 Key: KYLIN-3505
                 URL: https://issues.apache.org/jira/browse/KYLIN-3505
             Project: Kylin
          Issue Type: Improvement
          Components: Metadata
            Reporter: Ian Hu
            Assignee: Ian Hu


Wrong usage of cache in org.apache.kylin.metadata.datatype.DataType#getType.
{code:java}
public static DataType getType(String type) {
    if (type == null)
        return null;

    DataType dataType = new DataType(type); // <-- Always new
    DataType cached = CACHE.get(dataType); // already has dataType why fetch it from cache?
    if (cached == null) {
        CACHE.put(dataType, dataType); // <-- Seed cache
        cached = dataType;
    }
    return cached;
}
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)