syhily commented on code in PR #24:
URL: 
https://github.com/apache/flink-connector-pulsar/pull/24#discussion_r1103481149


##########
flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/utils/PulsarTransactionUtils.java:
##########
@@ -46,17 +45,18 @@ private PulsarTransactionUtils() {
     /** Create transaction with given timeout millis. */
     public static Transaction createTransaction(PulsarClient pulsarClient, 
long timeoutMs) {
         try {
-            CompletableFuture<Transaction> future =
-                    sneakyClient(pulsarClient::newTransaction)
-                            .withTransactionTimeout(timeoutMs, 
TimeUnit.MILLISECONDS)
-                            .build();
-
-            return future.get();
+            return pulsarClient
+                    .newTransaction()
+                    .withTransactionTimeout(timeoutMs, TimeUnit.MILLISECONDS)
+                    .build()
+                    .get();
         } catch (InterruptedException e) {
             Thread.currentThread().interrupt();
             throw new IllegalStateException(e);
         } catch (ExecutionException e) {
             throw new FlinkRuntimeException(unwrap(e));
+        } catch (PulsarClientException e) {

Review Comment:
   You are right. I changed it to Pulsar's built-in handle method.
   
   ```java
   public static Transaction createTransaction(PulsarClient pulsarClient, long 
timeoutMs)
           throws PulsarClientException {
       try {
           return pulsarClient
                   .newTransaction()
                   .withTransactionTimeout(timeoutMs, TimeUnit.MILLISECONDS)
                   .build()
                   .get();
       } catch (InterruptedException e) {
           Thread.currentThread().interrupt();
           throw new PulsarClientException(e);
       } catch (Exception e) {
           throw PulsarClientException.unwrap(e);
       }
   }
   ```



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to