@Override public void deleteChannel() { if (!isClosed() || this.fileChannel.isOpen()) { throw new IllegalStateException("Cannot delete a channel that is open."); } // make a best effort to delete the file. Don't report exceptions. try { File f = new File(this.id.getPath()); if (f.exists()) { f.delete(); } } catch (Throwable t) {} }
private void clearChannels() { for (ChannelWithMeta meta : channelIDs) { final File f = new File(meta.getChannel().getPath()); if (f.exists()) { f.delete(); } } channelIDs.clear(); spillSize = 0; numRowsUntilThisChannel.clear(); }
void clearFiles() { // we have to loop this, because it may fail with a concurrent modification exception while (!this.channelsToBeDelete.isEmpty()) { try { for (Iterator<FileIOChannel.ID> channels = this.channelsToBeDelete.iterator(); channels.hasNext(); ) { final FileIOChannel.ID channel = channels.next(); channels.remove(); try { final File f = new File(channel.getPath()); if (f.exists()) { f.delete(); } } catch (Throwable t) {} } } catch (Throwable t) {} } } }
channels.remove(); try { final File f = new File(channel.getPath()); if (f.exists()) { f.delete();
channels.remove(); try { final File f = new File(channel.getPath()); if (f.exists()) { f.delete();
channels.remove(); try { final File f = new File(channel.getPath()); if (f.exists()) { f.delete();
@Override public synchronized void close() { if (this.closed) { return; } this.closed = true; for (Iterator<FileIOChannel> channels = this.openChannels.iterator(); channels.hasNext(); ) { final FileIOChannel channel = channels.next(); channels.remove(); try { channel.closeAndDelete(); } catch (Throwable ignored) { } } for (Iterator<FileIOChannel.ID> channels = this.channels.iterator(); channels.hasNext(); ) { final FileIOChannel.ID channel = channels.next(); channels.remove(); try { final File f = new File(channel.getPath()); if (f.exists()) { f.delete(); } } catch (Throwable ignored) { } } }
/** * Creates a new channel to the path indicated by the given ID. The channel hands IO requests to * the given request queue to be processed. * * @param channelID The id describing the path of the file that the channel accessed. * @param writeEnabled Flag describing whether the channel should be opened in read/write mode, rather * than in read-only mode. * @throws IOException Thrown, if the channel could no be opened. */ protected AbstractFileIOChannel(FileIOChannel.ID channelID, boolean writeEnabled) throws IOException { this.id = Preconditions.checkNotNull(channelID); try { @SuppressWarnings("resource") RandomAccessFile file = new RandomAccessFile(id.getPath(), writeEnabled ? "rw" : "r"); this.fileChannel = file.getChannel(); } catch (IOException e) { throw new IOException("Channel to path '" + channelID.getPath() + "' could not be opened.", e); } }
/** * Creates a new channel to the path indicated by the given ID. The channel hands IO requests to * the given request queue to be processed. * * @param channelID The id describing the path of the file that the channel accessed. * @param writeEnabled Flag describing whether the channel should be opened in read/write mode, rather * than in read-only mode. * @throws IOException Thrown, if the channel could no be opened. */ protected AbstractFileIOChannel(FileIOChannel.ID channelID, boolean writeEnabled) throws IOException { this.id = Preconditions.checkNotNull(channelID); try { @SuppressWarnings("resource") RandomAccessFile file = new RandomAccessFile(id.getPath(), writeEnabled ? "rw" : "r"); this.fileChannel = file.getChannel(); } catch (IOException e) { throw new IOException("Channel to path '" + channelID.getPath() + "' could not be opened.", e); } }
/** * Creates a new channel to the path indicated by the given ID. The channel hands IO requests to * the given request queue to be processed. * * @param channelID The id describing the path of the file that the channel accessed. * @param writeEnabled Flag describing whether the channel should be opened in read/write mode, rather * than in read-only mode. * @throws IOException Thrown, if the channel could no be opened. */ protected AbstractFileIOChannel(FileIOChannel.ID channelID, boolean writeEnabled) throws IOException { this.id = Preconditions.checkNotNull(channelID); try { @SuppressWarnings("resource") RandomAccessFile file = new RandomAccessFile(id.getPath(), writeEnabled ? "rw" : "r"); this.fileChannel = file.getChannel(); } catch (IOException e) { throw new IOException("Channel to path '" + channelID.getPath() + "' could not be opened.", e); } }
/** * Creates a new channel to the path indicated by the given ID. The channel hands IO requests to * the given request queue to be processed. * * @param channelID The id describing the path of the file that the channel accessed. * @param writeEnabled Flag describing whether the channel should be opened in read/write mode, rather * than in read-only mode. * @throws IOException Thrown, if the channel could no be opened. */ protected AbstractFileIOChannel(FileIOChannel.ID channelID, boolean writeEnabled) throws IOException { this.id = Preconditions.checkNotNull(channelID); try { @SuppressWarnings("resource") RandomAccessFile file = new RandomAccessFile(id.getPath(), writeEnabled ? "rw" : "r"); this.fileChannel = file.getChannel(); } catch (IOException e) { throw new IOException("Channel to path '" + channelID.getPath() + "' could not be opened.", e); } }
/** * Deletes the file underlying the given channel. If the channel is still open, this * call may fail. * * @param channel The channel to be deleted. * @throws IOException Thrown if the deletion fails. */ public void deleteChannel(FileIOChannel.ID channel) throws IOException { if (channel != null) { if (channel.getPathFile().exists() && !channel.getPathFile().delete()) { LOG.warn("IOManager failed to delete temporary file {}", channel.getPath()); } } }
/** * Deletes the file underlying the given channel. If the channel is still open, this * call may fail. * * @param channel The channel to be deleted. * @throws IOException Thrown if the deletion fails. */ public void deleteChannel(FileIOChannel.ID channel) throws IOException { if (channel != null) { if (channel.getPathFile().exists() && !channel.getPathFile().delete()) { LOG.warn("IOManager failed to delete temporary file {}", channel.getPath()); } } }
/** * Deletes the file underlying the given channel. If the channel is still open, this * call may fail. * * @param channel The channel to be deleted. * @throws IOException Thrown if the deletion fails. */ public void deleteChannel(FileIOChannel.ID channel) throws IOException { if (channel != null) { if (channel.getPathFile().exists() && !channel.getPathFile().delete()) { LOG.warn("IOManager failed to delete temporary file {}", channel.getPath()); } } }
@Override public void deleteChannel() { if (!isClosed() || this.fileChannel.isOpen()) { throw new IllegalStateException("Cannot delete a channel that is open."); } // make a best effort to delete the file. Don't report exceptions. try { File f = new File(this.id.getPath()); if (f.exists()) { f.delete(); } } catch (Throwable t) {} }
@Override public void deleteChannel() { if (!isClosed() || this.fileChannel.isOpen()) { throw new IllegalStateException("Cannot delete a channel that is open."); } // make a best effort to delete the file. Don't report exceptions. try { File f = new File(this.id.getPath()); if (f.exists()) { f.delete(); } } catch (Throwable t) {} }
@Override public void finish() throws IOException, InterruptedException { sortMerger.finishAdding(); List<SortedDataFile<Tuple2<Integer, T>>> remainFiles = sortMerger.getRemainingSortedDataFiles(); int nextFileId = 0; FileSystem localFileSystem = FileSystem.getLocalFileSystem(); for (SortedDataFile<Tuple2<Integer, T>> file : remainFiles) { // rename file localFileSystem.rename( new Path(file.getChannelID().getPath()), new Path(ExternalBlockShuffleUtils.generateDataPath(partitionDataRootPath, nextFileId++))); } LOG.info("Finish external result partition writing."); }
/** * Deletes the file underlying the given channel. If the channel is still open, this * call may fail. * * @param channel The channel to be deleted. * @throws IOException Thrown if the deletion fails. */ public void deleteChannel(FileIOChannel.ID channel) throws IOException { if (channel != null) { if (channel.getPathFile().exists() && !channel.getPathFile().delete()) { LOG.warn("IOManager failed to delete temporary file {}", channel.getPath()); } } }
@Override public void deleteChannel() { if (!isClosed() || this.fileChannel.isOpen()) { throw new IllegalStateException("Cannot delete a channel that is open."); } // make a best effort to delete the file. Don't report exceptions. try { File f = new File(this.id.getPath()); if (f.exists()) { f.delete(); } } catch (Throwable t) {} }
@Override public String toString() { return String.format("ExternalSubpartitionView [current read file path : %s]", currFsIn == null ? null : currFsIn.getChannelID().getPath()); }