Java 类org.apache.hadoop.io.nativeio.NativeIOException 实例源码

项目:hadoop    文件:TestCachingStrategy.java   
@Override
public void posixFadviseIfPossible(String name,
  FileDescriptor fd, long offset, long len, int flags)
      throws NativeIOException {
  if ((len < 0) || (len > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid length of " + len +
        " passed to posixFadviseIfPossible");
  }
  if ((offset < 0) || (offset > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid offset of " + offset +
        " passed to posixFadviseIfPossible");
  }
  Stats stats = map.get(name);
  if (stats == null) {
    stats = new Stats(name);
    map.put(name, stats);
  }
  stats.fadvise((int)offset, (int)len, flags);
  super.posixFadviseIfPossible(name, fd, offset, len, flags);
}
项目:aliyun-oss-hadoop-fs    文件:TestCachingStrategy.java   
@Override
public void posixFadviseIfPossible(String name,
  FileDescriptor fd, long offset, long len, int flags)
      throws NativeIOException {
  if ((len < 0) || (len > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid length of " + len +
        " passed to posixFadviseIfPossible");
  }
  if ((offset < 0) || (offset > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid offset of " + offset +
        " passed to posixFadviseIfPossible");
  }
  Stats stats = map.get(name);
  if (stats == null) {
    stats = new Stats(name);
    map.put(name, stats);
  }
  stats.fadvise((int)offset, (int)len, flags);
  super.posixFadviseIfPossible(name, fd, offset, len, flags);
}
项目:big-c    文件:TestCachingStrategy.java   
@Override
public void posixFadviseIfPossible(String name,
  FileDescriptor fd, long offset, long len, int flags)
      throws NativeIOException {
  if ((len < 0) || (len > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid length of " + len +
        " passed to posixFadviseIfPossible");
  }
  if ((offset < 0) || (offset > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid offset of " + offset +
        " passed to posixFadviseIfPossible");
  }
  Stats stats = map.get(name);
  if (stats == null) {
    stats = new Stats(name);
    map.put(name, stats);
  }
  stats.fadvise((int)offset, (int)len, flags);
  super.posixFadviseIfPossible(name, fd, offset, len, flags);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestCachingStrategy.java   
@Override
public void posixFadviseIfPossible(String name,
  FileDescriptor fd, long offset, long len, int flags)
      throws NativeIOException {
  if ((len < 0) || (len > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid length of " + len +
        " passed to posixFadviseIfPossible");
  }
  if ((offset < 0) || (offset > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid offset of " + offset +
        " passed to posixFadviseIfPossible");
  }
  Stats stats = map.get(name);
  if (stats == null) {
    stats = new Stats(name);
    map.put(name, stats);
  }
  stats.fadvise((int)offset, (int)len, flags);
  super.posixFadviseIfPossible(name, fd, offset, len, flags);
}
项目:FlexMap    文件:TestCachingStrategy.java   
@Override
public void posixFadviseIfPossible(String name,
  FileDescriptor fd, long offset, long len, int flags)
      throws NativeIOException {
  if ((len < 0) || (len > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid length of " + len +
        " passed to posixFadviseIfPossible");
  }
  if ((offset < 0) || (offset > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid offset of " + offset +
        " passed to posixFadviseIfPossible");
  }
  Stats stats = map.get(name);
  if (stats == null) {
    stats = new Stats(name);
    map.put(name, stats);
  }
  stats.fadvise((int)offset, (int)len, flags);
  super.posixFadviseIfPossible(name, fd, offset, len, flags);
}
项目:hadoop-on-lustre    文件:SecureIOUtils.java   
/**
 * Open the specified File for write access, ensuring that it does not exist.
 * @param f the file that we want to create
 * @param permissions we want to have on the file (if security is enabled)
 *
 * @throws AlreadyExistsException if the file already exists
 * @throws IOException if any other error occurred
 */
public static FileOutputStream createForWrite(File f, int permissions)
throws IOException {
  if (skipSecurity) {
    return insecureCreateForWrite(f, permissions);
  } else {
    // Use the native wrapper around open(2)
    try {
      FileDescriptor fd = NativeIO.open(f.getAbsolutePath(),
        NativeIO.O_WRONLY | NativeIO.O_CREAT | NativeIO.O_EXCL,
        permissions);
      return new FileOutputStream(fd);
    } catch (NativeIOException nioe) {
      if (nioe.getErrno() == Errno.EEXIST) {
        throw new AlreadyExistsException(nioe);
      }
      throw nioe;
    }
  }
}
项目:hadoop-on-lustre2    文件:TestCachingStrategy.java   
@Override
public void posixFadviseIfPossible(String name,
  FileDescriptor fd, long offset, long len, int flags)
      throws NativeIOException {
  if ((len < 0) || (len > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid length of " + len +
        " passed to posixFadviseIfPossible");
  }
  if ((offset < 0) || (offset > Integer.MAX_VALUE)) {
    throw new RuntimeException("invalid offset of " + offset +
        " passed to posixFadviseIfPossible");
  }
  Stats stats = map.get(name);
  if (stats == null) {
    stats = new Stats(name);
    map.put(name, stats);
  }
  stats.fadvise((int)offset, (int)len, flags);
  super.posixFadviseIfPossible(name, fd, offset, len, flags);
}
项目:hortonworks-extension    文件:SecureIOUtils.java   
/**
 * Open the specified File for write access, ensuring that it does not exist.
 * @param f the file that we want to create
 * @param permissions we want to have on the file (if security is enabled)
 *
 * @throws AlreadyExistsException if the file already exists
 * @throws IOException if any other error occurred
 */
public static FileOutputStream createForWrite(File f, int permissions)
throws IOException {
  if (skipSecurity) {
    return insecureCreateForWrite(f, permissions);
  } else {
    // Use the native wrapper around open(2)
    try {
      FileDescriptor fd = NativeIO.open(f.getAbsolutePath(),
        NativeIO.O_WRONLY | NativeIO.O_CREAT | NativeIO.O_EXCL,
        permissions);
      return new FileOutputStream(fd);
    } catch (NativeIOException nioe) {
      if (nioe.getErrno() == Errno.EEXIST) {
        throw new AlreadyExistsException(nioe);
      }
      throw nioe;
    }
  }
}
项目:hortonworks-extension    文件:SecureIOUtils.java   
/**
 * Open the specified File for write access, ensuring that it does not exist.
 * @param f the file that we want to create
 * @param permissions we want to have on the file (if security is enabled)
 *
 * @throws AlreadyExistsException if the file already exists
 * @throws IOException if any other error occurred
 */
public static FileOutputStream createForWrite(File f, int permissions)
throws IOException {
  if (skipSecurity) {
    return insecureCreateForWrite(f, permissions);
  } else {
    // Use the native wrapper around open(2)
    try {
      FileDescriptor fd = NativeIO.open(f.getAbsolutePath(),
        NativeIO.O_WRONLY | NativeIO.O_CREAT | NativeIO.O_EXCL,
        permissions);
      return new FileOutputStream(fd);
    } catch (NativeIOException nioe) {
      if (nioe.getErrno() == Errno.EEXIST) {
        throw new AlreadyExistsException(nioe);
      }
      throw nioe;
    }
  }
}
项目:hadoop    文件:FsDatasetAsyncDiskService.java   
public void submitSyncFileRangeRequest(FsVolumeImpl volume,
    final FileDescriptor fd, final long offset, final long nbytes,
    final int flags) {
  execute(volume.getCurrentDir(), new Runnable() {
    @Override
    public void run() {
      try {
        NativeIO.POSIX.syncFileRangeIfPossible(fd, offset, nbytes, flags);
      } catch (NativeIOException e) {
        LOG.warn("sync_file_range error", e);
      }
    }
  });
}
项目:hadoop    文件:Storage.java   
public static void rename(File from, File to) throws IOException {
  try {
    NativeIO.renameTo(from, to);
  } catch (NativeIOException e) {
    throw new IOException("Failed to rename " + from.getCanonicalPath()
      + " to " + to.getCanonicalPath() + " due to failure in native rename. "
      + e.toString());
  }
}
项目:hadoop    文件:AtomicFileOutputStream.java   
@Override
public void close() throws IOException {
  boolean triedToClose = false, success = false;
  try {
    flush();
    ((FileOutputStream)out).getChannel().force(true);

    triedToClose = true;
    super.close();
    success = true;
  } finally {
    if (success) {
      boolean renamed = tmpFile.renameTo(origFile);
      if (!renamed) {
        // On windows, renameTo does not replace.
        if (origFile.exists() && !origFile.delete()) {
          throw new IOException("Could not delete original file " + origFile);
        }
        try {
          NativeIO.renameTo(tmpFile, origFile);
        } catch (NativeIOException e) {
          throw new IOException("Could not rename temporary file " + tmpFile
            + " to " + origFile + " due to failure in native rename. "
            + e.toString());
        }
      }
    } else {
      if (!triedToClose) {
        // If we failed when flushing, try to close it to not leak an FD
        IOUtils.closeStream(out);
      }
      // close wasn't successful, try to delete the tmp file
      if (!tmpFile.delete()) {
        LOG.warn("Unable to delete tmp file " + tmpFile);
      }
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:FsDatasetAsyncDiskService.java   
public void submitSyncFileRangeRequest(FsVolumeImpl volume,
    final FileDescriptor fd, final long offset, final long nbytes,
    final int flags) {
  execute(volume.getCurrentDir(), new Runnable() {
    @Override
    public void run() {
      try {
        NativeIO.POSIX.syncFileRangeIfPossible(fd, offset, nbytes, flags);
      } catch (NativeIOException e) {
        LOG.warn("sync_file_range error", e);
      }
    }
  });
}
项目:aliyun-oss-hadoop-fs    文件:Storage.java   
public static void rename(File from, File to) throws IOException {
  try {
    NativeIO.renameTo(from, to);
  } catch (NativeIOException e) {
    throw new IOException("Failed to rename " + from.getCanonicalPath()
      + " to " + to.getCanonicalPath() + " due to failure in native rename. "
      + e.toString());
  }
}
项目:aliyun-oss-hadoop-fs    文件:AtomicFileOutputStream.java   
@Override
public void close() throws IOException {
  boolean triedToClose = false, success = false;
  try {
    flush();
    ((FileOutputStream)out).getChannel().force(true);

    triedToClose = true;
    super.close();
    success = true;
  } finally {
    if (success) {
      boolean renamed = tmpFile.renameTo(origFile);
      if (!renamed) {
        // On windows, renameTo does not replace.
        if (origFile.exists() && !origFile.delete()) {
          throw new IOException("Could not delete original file " + origFile);
        }
        try {
          NativeIO.renameTo(tmpFile, origFile);
        } catch (NativeIOException e) {
          throw new IOException("Could not rename temporary file " + tmpFile
            + " to " + origFile + " due to failure in native rename. "
            + e.toString());
        }
      }
    } else {
      if (!triedToClose) {
        // If we failed when flushing, try to close it to not leak an FD
        IOUtils.closeStream(out);
      }
      // close wasn't successful, try to delete the tmp file
      if (!tmpFile.delete()) {
        LOG.warn("Unable to delete tmp file " + tmpFile);
      }
    }
  }
}
项目:big-c    文件:FsDatasetAsyncDiskService.java   
public void submitSyncFileRangeRequest(FsVolumeImpl volume,
    final FileDescriptor fd, final long offset, final long nbytes,
    final int flags) {
  execute(volume.getCurrentDir(), new Runnable() {
    @Override
    public void run() {
      try {
        NativeIO.POSIX.syncFileRangeIfPossible(fd, offset, nbytes, flags);
      } catch (NativeIOException e) {
        LOG.warn("sync_file_range error", e);
      }
    }
  });
}
项目:big-c    文件:Storage.java   
public static void rename(File from, File to) throws IOException {
  try {
    NativeIO.renameTo(from, to);
  } catch (NativeIOException e) {
    throw new IOException("Failed to rename " + from.getCanonicalPath()
      + " to " + to.getCanonicalPath() + " due to failure in native rename. "
      + e.toString());
  }
}
项目:big-c    文件:AtomicFileOutputStream.java   
@Override
public void close() throws IOException {
  boolean triedToClose = false, success = false;
  try {
    flush();
    ((FileOutputStream)out).getChannel().force(true);

    triedToClose = true;
    super.close();
    success = true;
  } finally {
    if (success) {
      boolean renamed = tmpFile.renameTo(origFile);
      if (!renamed) {
        // On windows, renameTo does not replace.
        if (origFile.exists() && !origFile.delete()) {
          throw new IOException("Could not delete original file " + origFile);
        }
        try {
          NativeIO.renameTo(tmpFile, origFile);
        } catch (NativeIOException e) {
          throw new IOException("Could not rename temporary file " + tmpFile
            + " to " + origFile + " due to failure in native rename. "
            + e.toString());
        }
      }
    } else {
      if (!triedToClose) {
        // If we failed when flushing, try to close it to not leak an FD
        IOUtils.closeStream(out);
      }
      // close wasn't successful, try to delete the tmp file
      if (!tmpFile.delete()) {
        LOG.warn("Unable to delete tmp file " + tmpFile);
      }
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FsDatasetAsyncDiskService.java   
public void submitSyncFileRangeRequest(FsVolumeImpl volume,
    final FileDescriptor fd, final long offset, final long nbytes,
    final int flags) {
  execute(volume.getCurrentDir(), new Runnable() {
    @Override
    public void run() {
      try {
        NativeIO.POSIX.syncFileRangeIfPossible(fd, offset, nbytes, flags);
      } catch (NativeIOException e) {
        LOG.warn("sync_file_range error", e);
      }
    }
  });
}
项目:hadoop-2.6.0-cdh5.4.3    文件:Storage.java   
public static void rename(File from, File to) throws IOException {
  try {
    NativeIO.renameTo(from, to);
  } catch (NativeIOException e) {
    throw new IOException("Failed to rename " + from.getCanonicalPath()
      + " to " + to.getCanonicalPath() + " due to failure in native rename. "
      + e.toString());
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:AtomicFileOutputStream.java   
@Override
public void close() throws IOException {
  boolean triedToClose = false, success = false;
  try {
    flush();
    ((FileOutputStream)out).getChannel().force(true);

    triedToClose = true;
    super.close();
    success = true;
  } finally {
    if (success) {
      boolean renamed = tmpFile.renameTo(origFile);
      if (!renamed) {
        // On windows, renameTo does not replace.
        if (origFile.exists() && !origFile.delete()) {
          throw new IOException("Could not delete original file " + origFile);
        }
        try {
          NativeIO.renameTo(tmpFile, origFile);
        } catch (NativeIOException e) {
          throw new IOException("Could not rename temporary file " + tmpFile
            + " to " + origFile + " due to failure in native rename. "
            + e.toString());
        }
      }
    } else {
      if (!triedToClose) {
        // If we failed when flushing, try to close it to not leak an FD
        IOUtils.closeStream(out);
      }
      // close wasn't successful, try to delete the tmp file
      if (!tmpFile.delete()) {
        LOG.warn("Unable to delete tmp file " + tmpFile);
      }
    }
  }
}
项目:hadoop-EAR    文件:BlockDataFile.java   
public void posixFadviseIfPossible(long offset, long len, int flags,
    boolean sync) throws NativeIOException {
  if (fd != null) {
    if (sync) {
      NativeIO.posixFadviseIfPossible(fd, offset, len, flags);
    } else {
      volume.submitNativeIOTask(new PosixFadviseRunnable(fd, offset, len,
            flags, this));
    }
  } else if (file != null) {
    DataNode.LOG.warn("Failed to fadvise as file " + file
        + " is missing file descriptor");
  }
}
项目:PDHC    文件:FsDatasetAsyncDiskService.java   
public void submitSyncFileRangeRequest(FsVolumeImpl volume,
    final FileDescriptor fd, final long offset, final long nbytes,
    final int flags) {
  execute(volume.getCurrentDir(), new Runnable() {
    @Override
    public void run() {
      try {
        NativeIO.POSIX.syncFileRangeIfPossible(fd, offset, nbytes, flags);
      } catch (NativeIOException e) {
        LOG.warn("sync_file_range error", e);
      }
    }
  });
}
项目:FlexMap    文件:FsDatasetAsyncDiskService.java   
public void submitSyncFileRangeRequest(FsVolumeImpl volume,
    final FileDescriptor fd, final long offset, final long nbytes,
    final int flags) {
  execute(volume.getCurrentDir(), new Runnable() {
    @Override
    public void run() {
      try {
        NativeIO.POSIX.syncFileRangeIfPossible(fd, offset, nbytes, flags);
      } catch (NativeIOException e) {
        LOG.warn("sync_file_range error", e);
      }
    }
  });
}
项目:FlexMap    文件:Storage.java   
public static void rename(File from, File to) throws IOException {
  try {
    NativeIO.renameTo(from, to);
  } catch (NativeIOException e) {
    throw new IOException("Failed to rename " + from.getCanonicalPath()
      + " to " + to.getCanonicalPath() + " due to failure in native rename. "
      + e.toString());
  }
}
项目:FlexMap    文件:AtomicFileOutputStream.java   
@Override
public void close() throws IOException {
  boolean triedToClose = false, success = false;
  try {
    flush();
    ((FileOutputStream)out).getChannel().force(true);

    triedToClose = true;
    super.close();
    success = true;
  } finally {
    if (success) {
      boolean renamed = tmpFile.renameTo(origFile);
      if (!renamed) {
        // On windows, renameTo does not replace.
        if (origFile.exists() && !origFile.delete()) {
          throw new IOException("Could not delete original file " + origFile);
        }
        try {
          NativeIO.renameTo(tmpFile, origFile);
        } catch (NativeIOException e) {
          throw new IOException("Could not rename temporary file " + tmpFile
            + " to " + origFile + " due to failure in native rename. "
            + e.toString());
        }
      }
    } else {
      if (!triedToClose) {
        // If we failed when flushing, try to close it to not leak an FD
        IOUtils.closeStream(out);
      }
      // close wasn't successful, try to delete the tmp file
      if (!tmpFile.delete()) {
        LOG.warn("Unable to delete tmp file " + tmpFile);
      }
    }
  }
}
项目:hadoop    文件:WindowsSecureContainerExecutor.java   
private static native WinutilsProcessStub createTaskAsUser0(
String cwd, String jobName, String user, String pidFile, String cmdLine)
throws NativeIOException;
项目:aliyun-oss-hadoop-fs    文件:WindowsSecureContainerExecutor.java   
private static native WinutilsProcessStub createTaskAsUser0(
String cwd, String jobName, String user, String pidFile, String cmdLine)
throws NativeIOException;
项目:big-c    文件:WindowsSecureContainerExecutor.java   
private static native WinutilsProcessStub createTaskAsUser0(
String cwd, String jobName, String user, String pidFile, String cmdLine)
throws NativeIOException;
项目:hadoop-2.6.0-cdh5.4.3    文件:WindowsSecureContainerExecutor.java   
private static native WinutilsProcessStub createTaskAsUser0(
String cwd, String jobName, String user, String pidFile, String cmdLine)
throws NativeIOException;
项目:hadoop-EAR    文件:BlockDataFile.java   
public void posixFadviseIfPossible(long offset, long len, int flags)
    throws NativeIOException {
    posixFadviseIfPossible(offset, len, flags, false);
}
项目:hops    文件:WindowsSecureContainerExecutor.java   
private static native WinutilsProcessStub createTaskAsUser0(
String cwd, String jobName, String user, String pidFile, String cmdLine)
throws NativeIOException;
项目:hadoop    文件:WindowsSecureContainerExecutor.java   
public native void resume() throws NativeIOException;
项目:aliyun-oss-hadoop-fs    文件:WindowsSecureContainerExecutor.java   
public native void resume() throws NativeIOException;
项目:big-c    文件:WindowsSecureContainerExecutor.java   
public native void resume() throws NativeIOException;
项目:hadoop-2.6.0-cdh5.4.3    文件:WindowsSecureContainerExecutor.java   
public native void resume() throws NativeIOException;
项目:hops    文件:WindowsSecureContainerExecutor.java   
public native void resume() throws NativeIOException;