Search in sources :

Example 6 with FileIOChannel

use of org.apache.flink.runtime.io.disk.iomanager.FileIOChannel in project flink by apache.

the class SpillChannelManager method close.

@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) {
        }
    }
}
Also used : FileIOChannel(org.apache.flink.runtime.io.disk.iomanager.FileIOChannel) File(java.io.File)

Aggregations

FileIOChannel (org.apache.flink.runtime.io.disk.iomanager.FileIOChannel)6 File (java.io.File)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 MemorySegment (org.apache.flink.core.memory.MemorySegment)1 AbstractChannelWriterOutputView (org.apache.flink.runtime.io.disk.iomanager.AbstractChannelWriterOutputView)1 ChannelWriterOutputView (org.apache.flink.runtime.io.disk.iomanager.ChannelWriterOutputView)1 ID (org.apache.flink.runtime.io.disk.iomanager.FileIOChannel.ID)1 ChannelWithMeta (org.apache.flink.table.runtime.io.ChannelWithMeta)1