Xiaobo Liao created KYLIN-3908:
----------------------------------

             Summary: KylinClient's HttpRequest.releaseConnection is not needed 
in retrieveMetaData &  executeKylinQuery
                 Key: KYLIN-3908
                 URL: https://issues.apache.org/jira/browse/KYLIN-3908
             Project: Kylin
          Issue Type: Improvement
          Components: Driver - JDBC
    Affects Versions: v2.5.2
            Reporter: Xiaobo Liao
             Fix For: Future


In Kylin client's code 
[https://github.com/apache/kylin/blob/master/jdbc/src/main/java/org/apache/kylin/jdbc/KylinClient.java]

retrieveMetaData &  executeKylinQuery will call 
HttpRequestBase.releaseConnection() if the HTTP calls are succeeded, but not 
doing so if calls are failed.

According to HttpClient's stack trace, connections are released back to 
connection manager after content is consumed.  So it is not necessary to call 
releaseConnection in retrieveMetaData &  executeKylinQuery. 

Of course calling releaseConnection is not harmful, but the code now looks 
confusing that only calling releaseConnection if responded with 20x. 

 
BasicClientConnectionManager.releaseConnection(ManagedClientConnection, long, 
TimeUnit) line: 194    
    ManagedClientConnectionImpl.releaseConnection() line: 447    
    BasicManagedEntity.releaseManagedConnection() line: 201    
    BasicManagedEntity.streamClosed(InputStream) line: 176    
    EofSensorInputStream.checkClose() line: 237    
    EofSensorInputStream.close() line: 186    
    UTF8StreamJsonParser._closeInput() line: 242    
    UTF8StreamJsonParser(ParserBase).close() line: 385    
    ObjectMapper._readMapAndClose(JsonParser, JavaType) line: 3745    
    ObjectMapper.readValue(InputStream, Class<T>) line: 2796    
    KylinClient.executeKylinQuery(String, List<StatementParameter>, 
Map<String,String>) line: 379    
    KylinClient.executeQuery(String, List<AvaticaParameter>, List<Object>, 
Map<String,String>) line: 326    
    KylinResultSet.execute() line: 69    
    AvaticaConnection$1.execute() line: 607    
    KylinMeta.prepareAndExecute(Meta$StatementHandle, String, long, int, 
Meta$PrepareCallback) line: 111    
    
KylinConnection(AvaticaConnection).prepareAndExecuteInternal(AvaticaStatement, 
String, long) line: 615    
    KylinStatement(AvaticaStatement).executeInternal(String) line: 148    
    KylinStatement(AvaticaStatement).executeQuery(String) line: 218    



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

Reply via email to