Example usage for org.apache.hadoop.conf Configuration getLongBytes

List of usage examples for org.apache.hadoop.conf Configuration getLongBytes

Introduction

In this page you can find the example usage for org.apache.hadoop.conf Configuration getLongBytes.

Prototype

public long getLongBytes(String name, long defaultValue) 

Source Link

Document

Get the value of the name property as a long or human readable format.

Usage

From source file:com.ibm.stocator.fs.cos.COSUtils.java

License:Apache License

/**
 * Get a size property from the configuration: this property must be at least
 * equal to {@link COSConstants#MULTIPART_MIN_SIZE}. If it is too small, it is
 * rounded up to that minimum, and a warning printed.
 *
 * @param conf configuration//from www.  j a  v  a 2s  . c om
 * @param property property name
 * @param defVal default value
 * @return the value, guaranteed to be above the minimum size
 */
public static long getMultipartSizeProperty(Configuration conf, String property, long defVal) {
    long partSize = conf.getLongBytes(property, defVal);
    if (partSize < MULTIPART_MIN_SIZE) {
        LOG.warn("{} must be at least 5 MB; configured value is {}", property, partSize);
        partSize = MULTIPART_MIN_SIZE;
    }
    return partSize;
}