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


Java Options.writeBufferSize方法代码示例

本文整理汇总了Java中org.iq80.leveldb.Options.writeBufferSize方法的典型用法代码示例。如果您正苦于以下问题:Java Options.writeBufferSize方法的具体用法?Java Options.writeBufferSize怎么用?Java Options.writeBufferSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.iq80.leveldb.Options的用法示例。


在下文中一共展示了Options.writeBufferSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initRollingLevelDB

import org.iq80.leveldb.Options; //导入方法依赖的package包/类
private void initRollingLevelDB(Long dbStartTime,
    Path rollingInstanceDBPath) {
  if (rollingdbs.containsKey(dbStartTime)) {
    return;
  }
  Options options = new Options();
  options.createIfMissing(true);
  options.cacheSize(conf.getLong(
      YarnConfiguration.TIMELINE_SERVICE_LEVELDB_READ_CACHE_SIZE,
      YarnConfiguration.DEFAULT_TIMELINE_SERVICE_LEVELDB_READ_CACHE_SIZE));
  options.maxOpenFiles(conf.getInt(
      YarnConfiguration.TIMELINE_SERVICE_LEVELDB_MAX_OPEN_FILES,
      YarnConfiguration.DEFAULT_TIMELINE_SERVICE_LEVELDB_MAX_OPEN_FILES));
  options.writeBufferSize(conf.getInt(
      YarnConfiguration.TIMELINE_SERVICE_LEVELDB_WRITE_BUFFER_SIZE,
      YarnConfiguration.DEFAULT_TIMELINE_SERVICE_LEVELDB_WRITE_BUFFER_SIZE));
  LOG.info("Initializing rolling leveldb instance :" + rollingInstanceDBPath
      + " for start time: " + dbStartTime);
  DB db = null;
  try {
    db = factory.open(
        new File(rollingInstanceDBPath.toUri().getPath()), options);
    rollingdbs.put(dbStartTime, db);
    String dbName = fdf.format(dbStartTime);
    LOG.info("Added rolling leveldb instance " + dbName + " to " + getName());
  } catch (IOException ioe) {
    LOG.warn("Failed to open rolling leveldb instance :"
        + new File(rollingInstanceDBPath.toUri().getPath()), ioe);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:31,代码来源:RollingLevelDB.java

示例2: activateService

import org.iq80.leveldb.Options; //导入方法依赖的package包/类
@Override
public void activateService()
    throws Exception
{
    charset = Charset.forName( "UTF-8" );
    configuration.refresh();
    LevelDBEntityStoreConfiguration config = configuration.get();

    // Choose flavour
    String flavour = config.flavour().get();
    DBFactory factory;
    if( "jni".equalsIgnoreCase( flavour ) )
    {
        factory = newJniDBFactory();
    }
    else if( "java".equalsIgnoreCase( flavour ) )
    {
        factory = newJavaDBFactory();
    }
    else
    {
        factory = newDBFactory();
    }

    // Apply configuration
    Options options = new Options();
    options.createIfMissing( true );
    if( config.blockRestartInterval().get() != null )
    {
        options.blockRestartInterval( config.blockRestartInterval().get() );
    }
    if( config.blockSize().get() != null )
    {
        options.blockSize( config.blockSize().get() );
    }
    if( config.cacheSize().get() != null )
    {
        options.cacheSize( config.cacheSize().get() );
    }
    if( config.compression().get() != null )
    {
        options.compressionType( config.compression().get()
                                 ? CompressionType.SNAPPY
                                 : CompressionType.NONE );
    }
    if( config.maxOpenFiles().get() != null )
    {
        options.maxOpenFiles( config.maxOpenFiles().get() );
    }
    if( config.paranoidChecks().get() != null )
    {
        options.paranoidChecks( config.paranoidChecks().get() );
    }
    if( config.verifyChecksums().get() != null )
    {
        options.verifyChecksums( config.verifyChecksums().get() );
    }
    if( config.writeBufferSize().get() != null )
    {
        options.writeBufferSize( config.writeBufferSize().get() );
    }
    if( config.errorIfExists().get() != null )
    {
        options.errorIfExists( config.errorIfExists().get() );
    }

    // Open/Create the database
    File dbFile = new File( fileConfig.dataDirectory(), descriptor.identity().toString() );
    db = factory.open( dbFile, options );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:71,代码来源:LevelDBEntityStoreMixin.java


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