ivankelly commented on issue #790: BP-21:  New API close inconsistencies
URL: https://github.com/apache/bookkeeper/pull/790#issuecomment-348149888
 
 
   > because the problem I see this with separated seal call, what does it mean 
if seal failed, shall users call close or not?
   
   With this change, seal is completely divorced from the lifecycle of the 
local object. Once a WriteHandle has been sealed, the user can still call 
read() and all the methods of ReadHandle. As such, close would still need to be 
called. seal mutates the state of the remote object. 
   
   I would consider it to be analogous to #commit and #close in JDBC 
connection. They do different things, so they are different calls.
   https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html
   
   >  it is very huge change to the bookkeeper, we will have to change all the 
documentation and have a guide about what is the difference between seal and 
close if we are going to make this change.
   
   ```
   ~/src/bookkeeper $ find site -name \*.md -exec grep -i Clos[ei] {} \; | wc -l
   128
   ```
   
   I'd say about half a day to change documentation. Keep in mind that this 
will only be for new api, so most documentation would not have to change.
   
   > regarding asyncClose and close, it is not true in ReadHandle. it might be 
not very meaningful in current implementation. However at Twitter, we have been 
discussing about unwatch from zookeeper server when closing ledger. It is an 
action to clean up resources at the server side. We haven't done the change. 
But there is a possibility we need to clean up resources at the server side for 
different metadata backends in future. so from this point, I would not say 
'asyncClose' is not meaningful. asyncClose is still need for readonly handle.
   
   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.
   
   > I am also concerned on removing asyncClose, because leaving a close method 
there is not good for async programming. because it is a bit unknown whether 
close would be blocking or unblocking or not.
   
   The javadoc for autocloseable says that #close shouldn't throw 
InterrupttedException which suggests to me that it should never block.
   
   https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html#close
   
   > I think if the concern is about the inconsistency about "asyncClose" and 
"close".
   This is one of the concerns, but the overloaded meaning is also a problem.

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