Example usage for org.apache.hadoop HadoopIllegalArgumentException HadoopIllegalArgumentException

List of usage examples for org.apache.hadoop HadoopIllegalArgumentException HadoopIllegalArgumentException

Introduction

In this page you can find the example usage for org.apache.hadoop HadoopIllegalArgumentException HadoopIllegalArgumentException.

Prototype

public HadoopIllegalArgumentException(final String message) 

Source Link

Document

Constructs exception with the specified detail message.

Usage

From source file:com.mellanox.r4h.DFSClient.java

License:Apache License

/**
 * Truncate a file to an indicated size//ww w  . j a v  a2  s.  c o  m
 * See {@link ClientProtocol#truncate}.
 */
public boolean truncate(String src, long newLength) throws IOException {
    checkOpen();
    if (newLength < 0) {
        throw new HadoopIllegalArgumentException("Cannot truncate to a negative file size: " + newLength + ".");
    }
    try {
        return namenode.truncate(src, newLength, clientName);
    } catch (RemoteException re) {
        throw re.unwrapRemoteException(AccessControlException.class, UnresolvedPathException.class);
    }
}

From source file:com.mellanox.r4h.LeaseRenewer.java

License:Apache License

private void unsyncSetGraceSleepPeriod(final long gracePeriod) {
    if (gracePeriod < 100L) {
        throw new HadoopIllegalArgumentException(gracePeriod + " = gracePeriod < 100ms is too small.");
    }//from  w w  w. j a  va 2s  .  c  om
    this.gracePeriod = gracePeriod;
    final long half = gracePeriod / 2;
    this.sleepPeriod = half < LEASE_RENEWER_SLEEP_DEFAULT ? half : LEASE_RENEWER_SLEEP_DEFAULT;
}