You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/04/05 08:52:16 UTC

[GitHub] [ozone] szetszwo commented on pull request #3091: HDDS-6323. Close RocksObject(s).

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: issues-unsubscribe@ozone.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org