@Override public GridGgfsSecondaryOutputStreamDescriptor onFailure(Exception err) throws GridException { U.closeQuiet(out); U.error(log, "File create in DUAL mode failed [path=" + path + ", simpleCreate=" + simpleCreate + ", props=" + props + ", overwrite=" + overwrite + ", bufferSize=" + bufSize + ", replication=" + replication + ", blockSize=" + blockSize + ']', err); if (err instanceof GridGgfsException) throw (GridGgfsException)err; else throw new GridGgfsException("Failed to create the file due to secondary file system " + "exception: " + path, err); } };
@Override public GridGgfsSecondaryOutputStreamDescriptor onFailure(Exception err) throws GridException { U.closeQuiet(out); U.error(log, "File create in DUAL mode failed [path=" + path + ", simpleCreate=" + simpleCreate + ", props=" + props + ", overwrite=" + overwrite + ", bufferSize=" + bufSize + ", replication=" + replication + ", blockSize=" + blockSize + ']', err); if (err instanceof GridGgfsException) throw (GridGgfsException)err; else throw new GridGgfsException("Failed to create the file due to secondary file system " + "exception: " + path, err); } };
throw new GridGgfsException("Failed to acquire file lock (concurrently modified?): " + path);
throw new GridGgfsException("Failed to update file info with null value" + " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", c=" + c + ']'); throw new GridGgfsException("Failed to update file info (file IDs differ)" + " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", c=" + c + ']'); throw new GridGgfsException("Failed to update file info (file types differ)" + " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", c=" + c + ']');
throw new GridGgfsException("Failed to update file info with null value" + " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", c=" + c + ']'); throw new GridGgfsException("Failed to update file info (file IDs differ)" + " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", c=" + c + ']'); throw new GridGgfsException("Failed to update file info (file types differ)" + " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", c=" + c + ']');
throw new GridGgfsException("Failed to acquire file lock (concurrently modified?): " + path);
/** * @param errCode Error code. * @param err Error. * @throws GridException Based on error code. */ public static void throwError(Integer errCode, String err) throws GridException { assert err != null; assert errCode != -1; if (errCode == ERR_FILE_NOT_FOUND) throw new GridGgfsFileNotFoundException(err); else if (errCode == ERR_PATH_ALREADY_EXISTS) throw new GridGgfsPathAlreadyExistsException(err); else if (errCode == ERR_DIRECTORY_NOT_EMPTY) throw new GridGgfsDirectoryNotEmptyException(err); else if (errCode == ERR_PARENT_NOT_DIRECTORY) throw new GridGgfsParentNotDirectoryException(err); else if (errCode == ERR_INVALID_HDFS_VERSION) throw new GridGgfsInvalidHdfsVersionException(err); else if (errCode == ERR_CORRUPTED_FILE) throw new GridGgfsCorruptedFileException(err); else if (errCode == ERR_GGFS_GENERIC) throw new GridGgfsException(err); throw new GridException(err); }
/** * @param errCode Error code. * @param err Error. * @throws GridException Based on error code. */ public static void throwError(Integer errCode, String err) throws GridException { assert err != null; assert errCode != -1; if (errCode == ERR_FILE_NOT_FOUND) throw new GridGgfsFileNotFoundException(err); else if (errCode == ERR_PATH_ALREADY_EXISTS) throw new GridGgfsPathAlreadyExistsException(err); else if (errCode == ERR_DIRECTORY_NOT_EMPTY) throw new GridGgfsDirectoryNotEmptyException(err); else if (errCode == ERR_PARENT_NOT_DIRECTORY) throw new GridGgfsParentNotDirectoryException(err); else if (errCode == ERR_INVALID_HDFS_VERSION) throw new GridGgfsInvalidHdfsVersionException(err); else if (errCode == ERR_CORRUPTED_FILE) throw new GridGgfsCorruptedFileException(err); else if (errCode == ERR_GGFS_GENERIC) throw new GridGgfsException(err); throw new GridException(err); }
@Override public GridGgfsSecondaryOutputStreamDescriptor onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { GridGgfsFileInfo info = infos.get(path); if (info.isDirectory()) throw new GridGgfsException("Failed to open output stream to the file in the " + "secondary file system because the path points to a directory: " + path); out = fs.append(path, bufSize, false, null); // Synchronize file ending. long len = info.length(); int blockSize = info.blockSize(); int remainder = (int)(len % blockSize); if (remainder > 0) { int blockIdx = (int)(len / blockSize); GridGgfsReader reader = fs.open(path, bufSize); try { ggfsCtx.data().dataBlock(info, path, blockIdx, reader).get(); } finally { reader.close(); } } // Set lock and return. info = lockInfo(info); metaCache.putx(info.id(), info); return new GridGgfsSecondaryOutputStreamDescriptor(infos.get(path.parent()).id(), info, out); }
throw new GridGgfsException("Failed to rename the path in the local file system " + "because destination path already exists and it is a file: " + dest); else
@Override public GridGgfsSecondaryOutputStreamDescriptor onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { GridGgfsFileInfo info = infos.get(path); if (info.isDirectory()) throw new GridGgfsException("Failed to open output stream to the file in the " + "secondary file system because the path points to a directory: " + path); out = fs.append(path, bufSize, false, null); // Synchronize file ending. long len = info.length(); int blockSize = info.blockSize(); int remainder = (int)(len % blockSize); if (remainder > 0) { int blockIdx = (int)(len / blockSize); GridGgfsReader reader = fs.open(path, bufSize); try { ggfsCtx.data().dataBlock(info, path, blockIdx, reader).get(); } finally { reader.close(); } } // Set lock and return. info = lockInfo(info); metaCache.putx(info.id(), info); return new GridGgfsSecondaryOutputStreamDescriptor(infos.get(path.parent()).id(), info, out); }
throw new GridGgfsException("Failed to rename the path in the local file system " + "because destination path already exists and it is a file: " + dest); else
throw new GridGgfsException(e);
throw new GridGgfsException(e);
throw new GridGgfsException("Failed to get affinity (range is too wide)" + " [info=" + info + ", start=" + start + ", len=" + len + ']');
throw new GridGgfsException("Failed to remove file (file is opened for writing) [fileName=" + fileName + ", fileId=" + fileId + ", lockId=" + fileInfo.lockId() + ']');
throw new GridGgfsException("Failed to get affinity (range is too wide)" + " [info=" + info + ", start=" + start + ", len=" + len + ']');
throw new GridGgfsException("Failed to remove file (file is opened for writing) [fileName=" + fileName + ", fileId=" + fileId + ", lockId=" + fileInfo.lockId() + ']');
throw new GridGgfsException("Failed to add file details into cache: " + newFileInfo);
throw new GridGgfsException("Failed to add file details into cache: " + newFileInfo);