• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NativeDB类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.fusesource.leveldbjni.internal.NativeDB的典型用法代码示例。如果您正苦于以下问题:Java NativeDB类的具体用法?Java NativeDB怎么用?Java NativeDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NativeDB类属于org.fusesource.leveldbjni.internal包,在下文中一共展示了NativeDB类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startInternal

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
@Override
protected void startInternal() throws Exception {
  Path storeRoot = createStorageDir();
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LeveldbLogger());
  LOG.info("Using state database at " + storeRoot + " for recovery");
  File dbfile = new File(storeRoot.toString());
  try {
    db = JniDBFactory.factory.open(dbfile, options);
  } catch (NativeDB.DBException e) {
    if (e.isNotFound() || e.getMessage().contains(" does not exist ")) {
      LOG.info("Creating state database at " + dbfile);
      options.createIfMissing(true);
      try {
        db = JniDBFactory.factory.open(dbfile, options);
        // store version
        storeVersion();
      } catch (DBException dbErr) {
        throw new IOException(dbErr.getMessage(), dbErr);
      }
    } else {
      throw e;
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:LeveldbRMStateStore.java


示例2: startStore

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
private void startStore(Path recoveryRoot) throws IOException {
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LevelDBLogger());
  Path dbPath = new Path(recoveryRoot, STATE_DB_NAME);
  LOG.info("Using state database at " + dbPath + " for recovery");
  File dbfile = new File(dbPath.toString());
  try {
    stateDb = JniDBFactory.factory.open(dbfile, options);
  } catch (NativeDB.DBException e) {
    if (e.isNotFound() || e.getMessage().contains(" does not exist ")) {
      LOG.info("Creating state database at " + dbfile);
      options.createIfMissing(true);
      try {
        stateDb = JniDBFactory.factory.open(dbfile, options);
        storeVersion();
      } catch (DBException dbExc) {
        throw new IOException("Unable to create state store", dbExc);
      }
    } else {
      throw e;
    }
  }
  checkVersion();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:ShuffleHandler.java


示例3: openDatabase

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
protected DB openDatabase() throws Exception {
  Path storeRoot = createStorageDir();
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LeveldbLogger());
  LOG.info("Using state database at " + storeRoot + " for recovery");
  File dbfile = new File(storeRoot.toString());
  try {
    db = JniDBFactory.factory.open(dbfile, options);
  } catch (NativeDB.DBException e) {
    if (e.isNotFound() || e.getMessage().contains(" does not exist ")) {
      LOG.info("Creating state database at " + dbfile);
      options.createIfMissing(true);
      try {
        db = JniDBFactory.factory.open(dbfile, options);
        // store version
        storeVersion();
      } catch (DBException dbErr) {
        throw new IOException(dbErr.getMessage(), dbErr);
      }
    } else {
      throw e;
    }
  }
  return db;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:LeveldbRMStateStore.java


示例4: hasPrev

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
public boolean hasPrev() {
    if( !iterator.isValid() )
        return false;
    try {
        iterator.prev();
        try {
            return iterator.isValid();
        } finally {
            if (iterator.isValid()) {
                iterator.next();
            } else {
                iterator.seekToFirst();
            }
        }
    } catch (NativeDB.DBException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:SimbaService,项目名称:Simba,代码行数:19,代码来源:JniDBIterator.java


示例5: peekPrev

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
public Map.Entry<byte[], byte[]> peekPrev() {
    try {
        iterator.prev();
        try {
            return peekNext();
        } finally {
            if (iterator.isValid()) {
                iterator.next();
            } else {
                iterator.seekToFirst();
            }
        }
    } catch (NativeDB.DBException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:SimbaService,项目名称:Simba,代码行数:17,代码来源:JniDBIterator.java


示例6: initStorage

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
@Override
protected void initStorage(Configuration conf)
    throws IOException {
  Path storeRoot = createStorageDir(conf);
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LeveldbLogger());
  LOG.info("Using state database at " + storeRoot + " for recovery");
  File dbfile = new File(storeRoot.toString());
  try {
    db = JniDBFactory.factory.open(dbfile, options);
  } catch (NativeDB.DBException e) {
    if (e.isNotFound() || e.getMessage().contains(" does not exist ")) {
      LOG.info("Creating state database at " + dbfile);
      isNewlyCreated = true;
      options.createIfMissing(true);
      try {
        db = JniDBFactory.factory.open(dbfile, options);
        // store version
        storeVersion();
      } catch (DBException dbErr) {
        throw new IOException(dbErr.getMessage(), dbErr);
      }
    } else {
      throw e;
    }
  }
  checkVersion();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:NMLeveldbStateStoreService.java


示例7: startStorage

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
@Override
protected void startStorage() throws IOException {
  Path storeRoot = createStorageDir(getConfig());
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LeveldbLogger());
  LOG.info("Using state database at " + storeRoot + " for recovery");
  File dbfile = new File(storeRoot.toString());
  try {
    db = JniDBFactory.factory.open(dbfile, options);
  } catch (NativeDB.DBException e) {
    if (e.isNotFound() || e.getMessage().contains(" does not exist ")) {
      LOG.info("Creating state database at " + dbfile);
      options.createIfMissing(true);
      try {
        db = JniDBFactory.factory.open(dbfile, options);
        // store version
        storeVersion();
      } catch (DBException dbErr) {
        throw new IOException(dbErr.getMessage(), dbErr);
      }
    } else {
      throw e;
    }
  }
  checkVersion();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:HistoryServerLeveldbStateStoreService.java


示例8: openDatabase

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
protected DB openDatabase(Configuration conf) throws IOException {
  Path storeRoot = createStorageDir(conf);
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LeveldbLogger());
  LOG.info("Using state database at " + storeRoot + " for recovery");
  File dbfile = new File(storeRoot.toString());
  try {
    db = JniDBFactory.factory.open(dbfile, options);
  } catch (NativeDB.DBException e) {
    if (e.isNotFound() || e.getMessage().contains(" does not exist ")) {
      LOG.info("Creating state database at " + dbfile);
      isNewlyCreated = true;
      options.createIfMissing(true);
      try {
        db = JniDBFactory.factory.open(dbfile, options);
        // store version
        storeVersion();
      } catch (DBException dbErr) {
        throw new IOException(dbErr.getMessage(), dbErr);
      }
    } else {
      throw e;
    }
  }
  return db;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:28,代码来源:NMLeveldbStateStoreService.java


示例9: seek

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
public void seek(byte[] key) {
    try {
        iterator.seek(key);
    } catch (NativeDB.DBException e) {
        if( e.isNotFound() ) {
            throw new NoSuchElementException();
        } else {
            throw new RuntimeException(e);
        }
    }
}
 
开发者ID:SimbaService,项目名称:Simba,代码行数:12,代码来源:JniDBIterator.java


示例10: peekNext

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
public Map.Entry<byte[], byte[]> peekNext() {
    if(!iterator.isValid()) {
        throw new NoSuchElementException();
    }
    try {
        return new AbstractMap.SimpleImmutableEntry<byte[],byte[]>(iterator.key(), iterator.value());
    } catch (NativeDB.DBException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:SimbaService,项目名称:Simba,代码行数:11,代码来源:JniDBIterator.java


示例11: next

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
public Map.Entry<byte[], byte[]> next() {
    Map.Entry<byte[], byte[]> rc = peekNext();
    try {
        iterator.next();
    } catch (NativeDB.DBException e) {
        throw new RuntimeException(e);
    }
    return rc;
}
 
开发者ID:SimbaService,项目名称:Simba,代码行数:10,代码来源:JniDBIterator.java


示例12: prev

import org.fusesource.leveldbjni.internal.NativeDB; //导入依赖的package包/类
public Map.Entry<byte[], byte[]> prev() {
    Map.Entry<byte[], byte[]> rc = peekPrev();
    try {
        iterator.prev();
    } catch (NativeDB.DBException e) {
        throw new RuntimeException(e);
    }
    return rc;
}
 
开发者ID:SimbaService,项目名称:Simba,代码行数:10,代码来源:JniDBIterator.java



注:本文中的org.fusesource.leveldbjni.internal.NativeDB类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NativeGestureUtil类代码示例发布时间:2022-05-22
下一篇:
Java AuthenticationHandler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap