[ 
https://issues.apache.org/jira/browse/KYLIN-3908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16802668#comment-16802668
 ] 

Xiaobo Liao commented on KYLIN-3908:
------------------------------------

Yes, the current different handling of releaseConnection  for 20x and non-20x 
response is confusing. 

I just found the httpclient 4.2(Kylin uses 4.2.5 according to pom.xml) 
document, it demos the releaseConnection needs to be invoked. Though my test 
stack trace shows the connection is released if content is consumed.

[https://hc.apache.org/httpcomponents-client-4.2.x/quickstart.html].

I will update the code to follow the official instruction. 

> 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
>            Priority: Trivial
>             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