本文整理汇总了Java中org.rocksdb.ColumnFamilyHandle.dispose方法的典型用法代码示例。如果您正苦于以下问题:Java ColumnFamilyHandle.dispose方法的具体用法?Java ColumnFamilyHandle.dispose怎么用?Java ColumnFamilyHandle.dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.rocksdb.ColumnFamilyHandle
的用法示例。
在下文中一共展示了ColumnFamilyHandle.dispose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cleanup
import org.rocksdb.ColumnFamilyHandle; //导入方法依赖的package包/类
@Override
public void cleanup() {
LOG.info("Begin to close rocketDb of {}", rootDir);
for (ColumnFamilyHandle columnFamilyHandle : windowHandlers.values()) {
columnFamilyHandle.dispose();
}
if (ttlDB != null) {
ttlDB.close();
}
LOG.info("Successfully closed rocketDb of {}", rootDir);
}
示例2: cleanup
import org.rocksdb.ColumnFamilyHandle; //导入方法依赖的package包/类
@Override
public void cleanup() {
LOG.info("Begin to close rocketDb of {}", rootDir);
for (ColumnFamilyHandle columnFamilyHandle : windowHandlers.values()) {
columnFamilyHandle.dispose();
}
if (ttlDB != null) {
ttlDB.close();
}
LOG.info("Successfully closed rocketDb of {}", rootDir);
}
示例3: ttlDbOpenWithColumnFamilies
import org.rocksdb.ColumnFamilyHandle; //导入方法依赖的package包/类
public void ttlDbOpenWithColumnFamilies() throws RocksDBException, InterruptedException {
DBOptions dbOptions = null;
TtlDB ttlDB = null;
List<ColumnFamilyDescriptor> cfNames = new ArrayList<ColumnFamilyDescriptor>();
List<ColumnFamilyHandle> columnFamilyHandleList = new ArrayList<ColumnFamilyHandle>();
cfNames.add(new ColumnFamilyDescriptor(RocksDB.DEFAULT_COLUMN_FAMILY));
cfNames.add(new ColumnFamilyDescriptor("new_cf".getBytes()));
List<Integer> ttlValues = new ArrayList<Integer>();
// Default column family with infinite lifetime
ttlValues.add(0);
// new column family with 1 second ttl
ttlValues.add(1);
try {
System.out.println("Begin to open db");
dbOptions = new DBOptions().setCreateMissingColumnFamilies(true).setCreateIfMissing(true);
ttlDB = TtlDB.open(dbOptions, rootDir, cfNames, columnFamilyHandleList, ttlValues, false);
System.out.println("Successfully open db " + rootDir);
ttlDB.put("key".getBytes(), "value".getBytes());
assertThat(ttlDB.get("key".getBytes())).isEqualTo("value".getBytes());
ttlDB.put(columnFamilyHandleList.get(1), "key".getBytes(), "value".getBytes());
assertThat(ttlDB.get(columnFamilyHandleList.get(1), "key".getBytes())).isEqualTo("value".getBytes());
TimeUnit.SECONDS.sleep(2);
ttlDB.compactRange();
ttlDB.compactRange(columnFamilyHandleList.get(1));
assertThat(ttlDB.get("key".getBytes())).isNotNull();
assertThat(ttlDB.get(columnFamilyHandleList.get(1), "key".getBytes())).isNull();
} finally {
for (ColumnFamilyHandle columnFamilyHandle : columnFamilyHandleList) {
columnFamilyHandle.dispose();
}
if (ttlDB != null) {
ttlDB.close();
}
if (dbOptions != null) {
dbOptions.dispose();
}
}
}