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


Java NativeCodeLoader.buildSupportsSnappy方法代码示例

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


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

示例1: checkNativeCodeLoaded

import org.apache.hadoop.util.NativeCodeLoader; //导入方法依赖的package包/类
/**
 * Are the native snappy libraries loaded & initialized?
 */
public static void checkNativeCodeLoaded() {
    if (!NativeCodeLoader.isNativeCodeLoaded() ||
        !NativeCodeLoader.buildSupportsSnappy()) {
      throw new RuntimeException("native snappy library not available: " +
          "this version of libhadoop was built without " +
          "snappy support.");
    }
    if (!SnappyCompressor.isNativeCodeLoaded()) {
      throw new RuntimeException("native snappy library not available: " +
          "SnappyCompressor has not been loaded.");
    }
    if (!SnappyDecompressor.isNativeCodeLoaded()) {
      throw new RuntimeException("native snappy library not available: " +
          "SnappyDecompressor has not been loaded.");
    }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:20,代码来源:SnappyCodec.java

示例2: testNativeCodeLoaded

import org.apache.hadoop.util.NativeCodeLoader; //导入方法依赖的package包/类
@Test
public void testNativeCodeLoaded() {
  if (requireTestJni() == false) {
    LOG.info("TestNativeCodeLoader: libhadoop.so testing is not required.");
    return;
  }
  if (!NativeCodeLoader.isNativeCodeLoaded()) {
    fail("TestNativeCodeLoader: libhadoop.so testing was required, but " +
        "libhadoop.so was not loaded.");
  }
  assertFalse(NativeCodeLoader.getLibraryName().isEmpty());
  // library names are depended on platform and build envs
  // so just check names are available
  assertFalse(ZlibFactory.getLibraryName().isEmpty());
  if (NativeCodeLoader.buildSupportsSnappy()) {
    assertFalse(SnappyCodec.getLibraryName().isEmpty());
  }
  if (NativeCodeLoader.buildSupportsOpenssl()) {
    assertFalse(OpensslCipher.getLibraryName().isEmpty());
  }
  assertFalse(Lz4Codec.getLibraryName().isEmpty());
  LOG.info("TestNativeCodeLoader: libhadoop.so is loaded.");
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:TestNativeCodeLoader.java

示例3: checkNativeCodeLoaded

import org.apache.hadoop.util.NativeCodeLoader; //导入方法依赖的package包/类
/**
 * Are the native snappy libraries loaded & initialized?
 */
public static void checkNativeCodeLoaded() {
    if (!NativeCodeLoader.buildSupportsSnappy()) {
      throw new RuntimeException("native snappy library not available: " +
          "this version of libhadoop was built without " +
          "snappy support.");
    }
    if (!SnappyCompressor.isNativeCodeLoaded()) {
      throw new RuntimeException("native snappy library not available: " +
          "SnappyCompressor has not been loaded.");
    }
    if (!SnappyDecompressor.isNativeCodeLoaded()) {
      throw new RuntimeException("native snappy library not available: " +
          "SnappyDecompressor has not been loaded.");
    }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:19,代码来源:SnappyCodec.java

示例4: testNativeCodeLoaded

import org.apache.hadoop.util.NativeCodeLoader; //导入方法依赖的package包/类
@Test
public void testNativeCodeLoaded() {
  if (requireTestJni() == false) {
    LOG.info("TestNativeCodeLoader: libhadoop.so testing is not required.");
    return;
  }
  if (!NativeCodeLoader.isNativeCodeLoaded()) {
    fail("TestNativeCodeLoader: libhadoop.so testing was required, but " +
        "libhadoop.so was not loaded.");
  }
  assertFalse(NativeCodeLoader.getLibraryName().isEmpty());
  // library names are depended on platform and build envs
  // so just check names are available
  assertFalse(ZlibFactory.getLibraryName().isEmpty());
  if (NativeCodeLoader.buildSupportsSnappy()) {
    assertFalse(SnappyCodec.getLibraryName().isEmpty());
  }
  assertFalse(Lz4Codec.getLibraryName().isEmpty());
  LOG.info("TestNativeCodeLoader: libhadoop.so is loaded.");
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:21,代码来源:TestNativeCodeLoader.java

示例5: checkNativeCodeLoaded

import org.apache.hadoop.util.NativeCodeLoader; //导入方法依赖的package包/类
/**
 * Are the native snappy libraries loaded & initialized?
 */
public static void checkNativeCodeLoaded() {
  if (!NativeCodeLoader.buildSupportsSnappy()) {
    throw new RuntimeException("native snappy library not available: " +
        "this version of libhadoop was built without " +
        "snappy support.");
  }
  if (!NativeCodeLoader.isNativeCodeLoaded()) {
    throw new RuntimeException("Failed to load libhadoop.");
  }
  if (!SnappyCompressor.isNativeCodeLoaded()) {
    throw new RuntimeException("native snappy library not available: " +
        "SnappyCompressor has not been loaded.");
  }
  if (!SnappyDecompressor.isNativeCodeLoaded()) {
    throw new RuntimeException("native snappy library not available: " +
        "SnappyDecompressor has not been loaded.");
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:22,代码来源:SnappyCodec.java

示例6: main

import org.apache.hadoop.util.NativeCodeLoader; //导入方法依赖的package包/类
/**
 * A tool to test native library availability, 
 */
public static void main(String[] args) {
  String usage = "NativeLibraryChecker [-a|-h]\n"
      + "  -a  use -a to check all libraries are available\n"
      + "      by default just check hadoop library is available\n"
      + "      exit with error code 1 if check failed\n"
      + "  -h  print this message\n";
  if (args.length > 1 ||
      (args.length == 1 &&
          !(args[0].equals("-a") || args[0].equals("-h")))) {
    System.err.println(usage);
    ExitUtil.terminate(1);
  }
  boolean checkAll = false;
  if (args.length == 1) {
    if (args[0].equals("-h")) {
      System.out.println(usage);
      return;
    }
    checkAll = true;
  }
  Configuration conf = new Configuration();
  boolean nativeHadoopLoaded = NativeCodeLoader.isNativeCodeLoaded();
  boolean zlibLoaded = false;
  boolean snappyLoaded = false;
  // lz4 is linked within libhadoop
  boolean lz4Loaded = nativeHadoopLoaded;
  boolean bzip2Loaded = Bzip2Factory.isNativeBzip2Loaded(conf);
  String hadoopLibraryName = "";
  String zlibLibraryName = "";
  String snappyLibraryName = "";
  String lz4LibraryName = "";
  String bzip2LibraryName = "";
  if (nativeHadoopLoaded) {
    hadoopLibraryName = NativeCodeLoader.getLibraryName();
    zlibLoaded = ZlibFactory.isNativeZlibLoaded(conf);
    if (zlibLoaded) {
      zlibLibraryName = ZlibFactory.getLibraryName();
    }
    snappyLoaded = NativeCodeLoader.buildSupportsSnappy() &&
        SnappyCodec.isNativeCodeLoaded();
    if (snappyLoaded && NativeCodeLoader.buildSupportsSnappy()) {
      snappyLibraryName = SnappyCodec.getLibraryName();
    }
    if (lz4Loaded) {
      lz4LibraryName = Lz4Codec.getLibraryName();
    }
    if (bzip2Loaded) {
      bzip2LibraryName = Bzip2Factory.getLibraryName(conf);
    }
  }
  System.out.println("Native library checking:");
  System.out.printf("hadoop: %b %s\n", nativeHadoopLoaded, hadoopLibraryName);
  System.out.printf("zlib:   %b %s\n", zlibLoaded, zlibLibraryName);
  System.out.printf("snappy: %b %s\n", snappyLoaded, snappyLibraryName);
  System.out.printf("lz4:    %b %s\n", lz4Loaded, lz4LibraryName);
  System.out.printf("bzip2:  %b %s\n", bzip2Loaded, bzip2LibraryName);
  if ((!nativeHadoopLoaded) ||
      (checkAll && !(zlibLoaded && snappyLoaded && lz4Loaded && bzip2Loaded))) {
    // return 1 to indicated check failed
    ExitUtil.terminate(1);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:66,代码来源:NativeLibraryChecker.java


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