szetszwo commented on PR #3091:
URL: https://github.com/apache/ozone/pull/3091#issuecomment-1088440893

   > 2. Can you point out the documentation recommending that the DB should be 
closed on any exception.
   
   Unfortunately, it does not seems  any RocksDB documentation specifically 
talking about the DB should be closed on any exception.  (Please let me know if 
you could find one.) However, in the the example provided by 
https://github.com/facebook/rocksdb/wiki/RocksJava-Basics (copied below), they 
do use try-with-resource to close the db and the RocksObject for any exceptions.
   ```
     try (final Options options = new Options().setCreateIfMissing(true)) {
       
       // a factory method that returns a RocksDB instance
       try (final RocksDB db = RocksDB.open(options, "path/to/db")) {
       
           // do something
       }
     } catch (RocksDBException e) {
       // do some error handling
       ...
     }
   ```


-- 
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: [email protected]

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