@Override public synchronized void close() throws IOException { super.close(); }
private void ensureNotAppending(final ContentClaim claim) throws IOException { if (claim == null) { return; } final ByteCountingOutputStream outStream = appendableStreams.remove(claim); if (outStream == null) { return; } outStream.flush(); outStream.close(); }
private void resetWriteClaims(final boolean suppressExceptions) { for (final ByteCountingOutputStream out : appendableStreams.values()) { try { try { out.flush(); } finally { out.close(); } } catch (final IOException e) { if (!suppressExceptions) { throw new FlowFileAccessException("Unable to flush the output of FlowFile to the Content Repository"); } } } appendableStreams.clear(); }
private boolean remove(final ResourceClaim claim) { if (claim == null) { return false; } // If the claim is still in use, we won't remove it. if (claim.isInUse()) { return false; } Path path = null; try { path = getPath(claim); } catch (final ContentNotFoundException cnfe) { } // Ensure that we have no writable claim streams for this resource claim final ByteCountingOutputStream bcos = writableClaimStreams.remove(claim); if (bcos != null) { try { bcos.close(); } catch (final IOException e) { LOG.warn("Failed to close Output Stream for {} due to {}", claim, e); } } final File file = path.toFile(); if (!file.delete() && file.exists()) { LOG.warn("Unable to delete {} at path {}", new Object[]{claim, path}); return false; } return true; }
@Override public void close() throws IOException { if (callback != null) { callback.preFooterWrite(callbackContext); } // remove us from the memory manager so that we don't get any callbacks memoryManager.removeWriter(path); // actually close the file flushStripe(); int metadataLength = writeMetadata(); int footerLength = writeFooter(rawWriter.getBytesWritten() - metadataLength); rawWriter.write(writePostScript(footerLength, metadataLength)); rawWriter.close(); }
this.out.close();
@Override public synchronized void close() throws IOException { super.close(); }
@Override public void close() throws IOException { if (callback != null) { callback.preFooterWrite(callbackContext); } // remove us from the memory manager so that we don't get any callbacks memoryManager.removeWriter(path); // actually close the file flushStripe(); int metadataLength = writeMetadata(); int footerLength = writeFooter(rawWriter.getBytesWritten() - metadataLength); rawWriter.write(writePostScript(footerLength, metadataLength)); rawWriter.close(); }