Example usage for org.apache.hadoop.hdfs.protocol CacheDirectiveInfo toString

List of usage examples for org.apache.hadoop.hdfs.protocol CacheDirectiveInfo toString

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.protocol CacheDirectiveInfo toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.apache.impala.util.HdfsCachingUtil.java

License:Apache License

/**
 * Submits a new caching directive for the specified cache pool name, path and
 * replication. Returns the directive ID if the submission was successful or an
 * ImpalaRuntimeException if the submission fails.
 *///from w w  w  . j ava 2s  .c o  m
private static long submitDirective(Path path, String poolName, short replication)
        throws ImpalaRuntimeException {
    Preconditions.checkNotNull(path);
    Preconditions.checkState(poolName != null && !poolName.isEmpty());
    CacheDirectiveInfo info = new CacheDirectiveInfo.Builder().setExpiration(Expiration.NEVER).setPool(poolName)
            .setReplication(replication).setPath(path).build();
    if (LOG.isTraceEnabled()) {
        LOG.trace("Submitting cache directive: " + info.toString());
    }
    try {
        return getDfs().addCacheDirective(info);
    } catch (IOException e) {
        throw new ImpalaRuntimeException(e.getMessage(), e);
    }
}

From source file:org.apache.impala.util.HdfsCachingUtil.java

License:Apache License

/**
 * Update an existing cache directive to avoid having the same entry multiple
 * times//  w  w w .  ja  v a  2s  . c  o m
 */
private static void modifyCacheDirective(Long id, Path path, String poolName, short replication)
        throws ImpalaRuntimeException {
    Preconditions.checkNotNull(path);
    Preconditions.checkNotNull(id);
    Preconditions.checkState(poolName != null && !poolName.isEmpty());
    CacheDirectiveInfo info = new CacheDirectiveInfo.Builder().setId(id).setExpiration(Expiration.NEVER)
            .setPool(poolName).setReplication(replication).setPath(path).build();
    if (LOG.isTraceEnabled()) {
        LOG.trace("Modifying cache directive: " + info.toString());
    }
    try {
        getDfs().modifyCacheDirective(info);
    } catch (IOException e) {
        throw new ImpalaRuntimeException(e.getMessage(), e);
    }
}