[ 
https://issues.apache.org/jira/browse/GOBBLIN-1616?focusedWorklogId=747607&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-747607
 ]

ASF GitHub Bot logged work on GOBBLIN-1616:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Mar/22 04:53
            Start Date: 25/Mar/22 04:53
    Worklog Time Spent: 10m 
      Work Description: phet commented on a change in pull request #3486:
URL: https://github.com/apache/gobblin/pull/3486#discussion_r834799562



##########
File path: 
gobblin-salesforce/src/main/java/org/apache/gobblin/salesforce/SalesforceSource.java
##########
@@ -223,6 +224,15 @@ protected void addLineageSourceInfo(SourceState 
sourceState, SourceEntity entity
       }
     } catch (Exception e) {
       throw new RuntimeException(e);
+    } finally {
+      if(salesforceExtractor != null) {
+        try {
+          // Only close connection here since we don't want to update the high 
watermark for the workUnitState here

Review comment:
       apologize for ignorance, but what's the association between "only 
closing cnxn" and avoiding "update to HWM"?

##########
File path: 
gobblin-core/src/main/java/org/apache/gobblin/source/extractor/extract/restapi/RestApiConnector.java
##########
@@ -192,8 +190,8 @@ private static boolean hasId(JsonObject json) {
         if (httpEntity != null) {
           EntityUtils.consume(httpEntity);
         }
-        if(httpResponse instanceof CloseableHttpResponse) {
-          this.closer.register((CloseableHttpResponse)httpResponse);
+        if(httpResponse instanceof Closeable) {

Review comment:
       since the `Closer` is our only resource management angle, should we log 
when not a `Closeable`, to give some trace before falling through the cracks?  
better still would be to wrap within a holder that implements `Closeable`.
   
   I did observe we still use the non-`Closeable`, `AutoRetryHttpClient` in 
some circumstances.  if that's what we happen to have would the wrapper use its 
`ClientConnectionManger` to manage resources?

##########
File path: 
gobblin-core/src/main/java/org/apache/gobblin/source/extractor/extract/restapi/RestApiConnector.java
##########
@@ -192,8 +190,8 @@ private static boolean hasId(JsonObject json) {
         if (httpEntity != null) {
           EntityUtils.consume(httpEntity);
         }
-        if(httpResponse instanceof CloseableHttpResponse) {
-          this.closer.register((CloseableHttpResponse)httpResponse);
+        if(httpResponse instanceof Closeable) {
+          this.closer.register((Closeable)httpResponse);

Review comment:
       wondering, why situate in the `finally`, rather than the line following 
`httpResponse` assignment?  if you did that you could also reduce the var's 
scope.
   
   two minor nits: 1) space after `if`; convention for class members seems to 
include `this.` qualifier




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 747607)
    Time Spent: 1h 50m  (was: 1h 40m)

> Make RestApiConnector be able to close the connection finally
> -------------------------------------------------------------
>
>                 Key: GOBBLIN-1616
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1616
>             Project: Apache Gobblin
>          Issue Type: Bug
>            Reporter: Zihan Li
>            Priority: Major
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> In RestApiConnector, we only consume the HttpEntity but not close the 
> response, which potentially leave the socket as CLOSE_WAIT status and eat up 
> the resources. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to