当前位置: 首页>>代码示例>>Java>>正文


Java NativeDB类代码示例

本文整理汇总了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;未经允许,请勿转载。