sijie commented on issue #790: BP-21:  New API close inconsistencies
URL: https://github.com/apache/bookkeeper/pull/790#issuecomment-348160536
 
 
   > Why would the client need to wait for the response in this case? #close is 
traditionally for cleaning up resources. Is it meaningful for a client if close 
fails while cleaning up watchers? As in, can it do anything with that result? 
#seal failing communicates something to the client (i.e. that it probably 
shouldn't try to move to the next ledger). Cleaning up resources, not so much. 
Remote resources need to be able to clean themselves up eventually anyhow, 
given that clients can fail.
   
   it is not about wait for response. it is about having an async method for 
that. whether you want to wait until close to complete or not, it is up to 
applications. 
   
   ```
   The javadoc for autocloseable says that #close shouldn't throw 
InterrupttedException which suggests to me that it should never block.
   ```
   
   there is not any indication about whether it is a blocking call or 
non-blocking call. but in an interface that having async and sync methods, 
#close() typically means a blocking call. that's why people usually have a 
asyncClose or closeAsync call.
   
   
   I am not sure about `seal` and `close`, I would defer to see if other 
people's opinions.
   
   regarding `close`, I would insist us need both sync and async version of 
close. so -1 on removing async version of close. if we want to make methods 
consistency, we can do something like below.
   
   ```
   CompletableFuture<T> methodAsync();
   T method() throws BKException;
   
   CompletableFuture<Void> closeAsync();
   void close() ...;
   ``` 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to