diff --git a/java/samples/src/main/java/RocksDBSample.java b/java/samples/src/main/java/RocksDBSample.java index b1f980555..f61995ed9 100644 --- a/java/samples/src/main/java/RocksDBSample.java +++ b/java/samples/src/main/java/RocksDBSample.java @@ -31,6 +31,7 @@ public class RocksDBSample { final Filter bloomFilter = new BloomFilter(10); final ReadOptions readOptions = new ReadOptions() .setFillCache(false); + final Statistics stats = new Statistics(); final RateLimiter rateLimiter = new RateLimiter(10000000,10000, 10)) { try (final RocksDB db = RocksDB.open(options, db_path_not_found)) { @@ -41,7 +42,7 @@ public class RocksDBSample { try { options.setCreateIfMissing(true) - .createStatistics() + .setStatistics(stats) .setWriteBufferSize(8 * SizeUnit.KB) .setMaxWriteBufferNumber(3) .setMaxBackgroundCompactions(10) @@ -51,8 +52,6 @@ public class RocksDBSample { assert (false); } - final Statistics stats = options.statisticsPtr(); - assert (options.createIfMissing() == true); assert (options.writeBufferSize() == 8 * SizeUnit.KB); assert (options.maxWriteBufferNumber() == 3); @@ -221,7 +220,9 @@ public class RocksDBSample { try { for (final TickerType statsType : TickerType.values()) { - stats.getTickerCount(statsType); + if (statsType != TickerType.TICKER_ENUM_MAX) { + stats.getTickerCount(statsType); + } } System.out.println("getTickerCount() passed."); } catch (final Exception e) { @@ -231,7 +232,9 @@ public class RocksDBSample { try { for (final HistogramType histogramType : HistogramType.values()) { - HistogramData data = stats.getHistogramData(histogramType); + if (histogramType != HistogramType.HISTOGRAM_ENUM_MAX) { + HistogramData data = stats.getHistogramData(histogramType); + } } System.out.println("getHistogramData() passed."); } catch (final Exception e) {