ruanwenjun commented on a change in pull request #369:
URL: 
https://github.com/apache/incubator-eventmesh/pull/369#discussion_r640249505



##########
File path: 
eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/AbstractLiteClient.java
##########
@@ -46,4 +53,22 @@ public LiteClientConfig getLiteClientConfig() {
     public void shutdown() throws Exception {
         logger.info("AbstractLiteClient shutdown");
     }
+
+    public CloseableHttpClient setHttpClient() throws Exception {

Review comment:
       Declare that throwing a specific exception may be better than throw 
Exception.

##########
File path: 
eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/LiteConsumer.java
##########
@@ -126,10 +127,13 @@ public boolean subscribe(List<String> topicList, String 
url) throws Exception {
         long startTime = System.currentTimeMillis();
         String target = selectEventMesh();
         String subRes = "";
+        CloseableHttpClient httpClient = setHttpClient();

Review comment:
       Can we use `try with resource` here?
   ```java
   try (CloseableHttpClient httpClient = setHttpClient()){
   
   }catch(){
   
   }
   ```
   And I think it's not very good to do a conversion on `Exception` here, which 
will hide the source of the `Exception`. If the `Exception` is not currently 
handled, the best way may to throw it directly instead of wrapping it.




-- 
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to