Example usage for org.apache.hadoop.hdfs DFSOutputStream abort

List of usage examples for org.apache.hadoop.hdfs DFSOutputStream abort

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs DFSOutputStream abort.

Prototype

void abort() throws IOException 

Source Link

Document

Aborts this output stream and releases any system resources associated with this stream.

Usage

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

License:Apache License

/** Close/abort all files being written. */
private void closeAllFilesBeingWritten(final boolean abort) {
    for (;;) {//from  www . java 2s.c om
        final long inodeId;
        final DFSOutputStream out;
        synchronized (filesBeingWritten) {
            if (filesBeingWritten.isEmpty()) {
                return;
            }
            inodeId = filesBeingWritten.keySet().iterator().next();
            out = filesBeingWritten.remove(inodeId);
        }
        if (out != null) {
            try {
                if (abort) {
                    out.abort();
                } else {
                    out.close();
                }
            } catch (IOException ie) {
                LOG.error("Failed to " + (abort ? "abort" : "close") + " inode " + inodeId, ie);
            }
        }
    }
}