flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GJL <...@git.apache.org>
Subject [GitHub] flink pull request #4915: [FLINK-7838] Bunch of hotfixes and fix missing syn...
Date Fri, 27 Oct 2017 15:29:54 GMT
Github user GJL commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4915#discussion_r147442314
  
    --- Diff: flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer011.java
---
    @@ -563,7 +553,7 @@ public void close() throws Exception {
     			asyncException = ExceptionUtils.firstOrSuppressed(e, asyncException);
     		}
     		try {
    -			producersPool.close();
    +			producersPool.ifPresent(pool -> pool.close());
    --- End diff --
    
    I am not adamant about it but using `Optional` in private fields is not without controversy:
https://stackoverflow.com/a/26328555
    
    Also, `ifPresent(pool -> pool.close()` only works because `close` does not declare
any checked exceptions. If it did, the code would not compile.


---

Mime
View raw message