public void flush(final ContentClaim contentClaim) throws IOException { if (contentClaim == null) { return; } flush(contentClaim.getResourceClaim()); }
public void flush() throws IOException { forEachStream(OutputStream::flush); }
public ContentClaim getContentClaim() throws IOException { final ContentClaim contentClaim = queue.poll(); if (contentClaim != null) { contentRepo.incrementClaimaintCount(contentClaim); return contentClaim; } final ContentClaim claim = contentRepo.create(false); registerStream(claim); return claim; }
ContentClaim newClaim = null; try { newClaim = claimCache.getContentClaim(); claimLog.debug("Creating ContentClaim {} for 'write' for {}", newClaim, source); claimCache.flush(currClaim.getResourceClaim()); final InputStream disableOnCloseIn = new DisableOnCloseInputStream(limitedIn); final ByteCountingInputStream countingIn = new ByteCountingInputStream(disableOnCloseIn, bytesRead); final OutputStream os = claimCache.write(newClaim); final OutputStream disableOnCloseOut = new DisableOnCloseOutputStream(os); final ByteCountingOutputStream countingOut = new ByteCountingOutputStream(disableOnCloseOut)) {
newClaim = claimCache.getContentClaim(); claimLog.debug("Creating ContentClaim {} for 'write' for {}", newClaim, source); ensureNotAppending(newClaim); final OutputStream rawStream = claimCache.write(newClaim); final OutputStream disableOnClose = new DisableOnCloseOutputStream(rawStream); final ByteCountingOutputStream countingOut = new ByteCountingOutputStream(disableOnClose);
this.sessionId = idGenerator.getAndIncrement(); this.connectableDescription = description; this.claimCache = new ContentClaimWriteCache(context.getContentRepository()); LOG.trace("Session {} created for {}", this, connectableDescription); processingStartTime = System.nanoTime();
claimCache.reset(); } catch (IOException e1) { LOG.warn("{} Attempted to close Output Stream for {} due to session rollback but close failed", this, this.connectableDescription, e1);
ContentClaim newClaim = null; try { newClaim = claimCache.getContentClaim(); claimLog.debug("Creating ContentClaim {} for 'write' for {}", newClaim, source); try (final OutputStream stream = claimCache.write(newClaim); final OutputStream disableOnClose = new DisableOnCloseOutputStream(stream); final ByteCountingOutputStream countingOut = new ByteCountingOutputStream(disableOnClose)) {
public OutputStream write(final ContentClaim claim) throws IOException { OutputStream out = streamMap.get(claim.getResourceClaim()); if (out == null) { out = registerStream(claim);
public void reset() throws IOException { try { forEachStream(OutputStream::close); } finally { streamMap.clear(); queue.clear(); } }
claimCache.flush(record.getCurrentClaim()); } catch (final IOException e) { throw new FlowFileAccessException("Unable to read from source " + source + " due to " + e.toString(), e);
@Override public void exportTo(FlowFile source, final Path destination, final boolean append) { verifyTaskActive(); source = validateRecordState(source); final StandardRepositoryRecord record = getRecord(source); try { ensureNotAppending(record.getCurrentClaim()); claimCache.flush(record.getCurrentClaim()); final long copyCount = context.getContentRepository().exportTo(record.getCurrentClaim(), destination, append, record.getCurrentClaimOffset(), source.getSize()); bytesRead += copyCount; bytesWritten += copyCount; } catch (final ContentNotFoundException nfe) { handleContentNotFound(nfe, record); } catch (final Throwable t) { throw new FlowFileAccessException("Failed to export " + source + " to " + destination + " due to " + t.toString(), t); } }
try { if (outStream == null) { claimCache.flush(oldClaim);
final ContentClaim currentClaim = record.getCurrentClaim(); ensureNotAppending(currentClaim); claimCache.flush(currentClaim); } catch (final IOException e) { throw new FlowFileAccessException("Failed to access ContentClaim for " + source.toString(), e);
claimCache.flush(record.getCurrentClaim()); } catch (final IOException e) { throw new FlowFileAccessException("Failed to access ContentClaim for " + source.toString(), e);
claimCache.flush(record.getCurrentClaim()); } catch (final IOException e) { throw new FlowFileAccessException("Failed to access ContentClaim for " + source.toString(), e);