private void closeWriter(final RecordSetWriter writer) { try { if (writer != null) { writer.close(); } } catch (final Exception ioe) { logger.warn("Failed to close Record Writer", ioe); } }
private void closeWriter(final RecordSetWriter writer) { try { if (writer != null) { writer.close(); } } catch (final Exception ioe) { logger.warn("Failed to close Record Writer", ioe); } }
private void closeWriter(final RecordSetWriter writer) { try { if (writer != null) { writer.close(); } } catch (final Exception ioe) { logger.warn("Failed to close Record Writer", ioe); } }
private void closeQuietly(final RecordSetWriter writer) { if (writer != null) { try { writer.close(); } catch (final Exception e) { getLogger().error("Failed to close Record Writer", e); } } }
public void rollback() { complete = true; logger.debug("Marked {} as complete because rollback() was called", new Object[] {this}); writeLock.lock(); try { if (recordWriter != null) { try { recordWriter.close(); } catch (IOException e) { logger.warn("Failed to close Record Writer", e); } } session.rollback(); if (logger.isDebugEnabled()) { final List<String> ids = flowFiles.stream().map(ff -> " id=" + ff.getId() + ",").collect(Collectors.toList()); logger.debug("Rolled back bin {} containing input FlowFiles {}", new Object[] {this, ids}); } } finally { writeLock.unlock(); } }
private void completeFlowFile(final ProcessSession session, final FlowFile flowFile, final RecordSetWriter writer, final Relationship relationship, final String details) throws IOException { final WriteResult writeResult = writer.finishRecordSet(); writer.close(); final Map<String, String> attributes = new HashMap<>(); attributes.putAll(writeResult.getAttributes()); attributes.put("record.count", String.valueOf(writeResult.getRecordCount())); attributes.put(CoreAttributes.MIME_TYPE.key(), writer.getMimeType()); session.putAllAttributes(flowFile, attributes); session.transfer(flowFile, relationship); session.getProvenanceReporter().route(flowFile, relationship, details); }
private void fail() { complete = true; logger.debug("Marked {} as complete because fail() was called", new Object[] {this}); writeLock.lock(); try { if (recordWriter != null) { try { recordWriter.close(); } catch (IOException e) { logger.warn("Failed to close Record Writer", e); } } session.remove(merged); session.transfer(flowFiles, MergeRecord.REL_FAILURE); session.commit(); } finally { writeLock.unlock(); } }
private boolean processBundle(final BundleTracker bundle) throws IOException { final RecordSetWriter writer = bundle.recordWriter; if (writer != null) { final WriteResult writeResult; try { writeResult = writer.finishRecordSet(); } finally { writer.close(); } if (writeResult.getRecordCount() == 0) { getProcessSession().remove(bundle.flowFile); return false; } final Map<String, String> attributes = new HashMap<>(); attributes.putAll(writeResult.getAttributes()); attributes.put(CoreAttributes.MIME_TYPE.key(), writer.getMimeType()); bundle.flowFile = getProcessSession().putAllAttributes(bundle.flowFile, attributes); } populateAttributes(bundle); return true; }
private boolean processBundle(final BundleTracker bundle) throws IOException { final RecordSetWriter writer = bundle.recordWriter; if (writer != null) { final WriteResult writeResult; try { writeResult = writer.finishRecordSet(); } finally { writer.close(); } if (writeResult.getRecordCount() == 0) { getProcessSession().remove(bundle.flowFile); return false; } final Map<String, String> attributes = new HashMap<>(); attributes.putAll(writeResult.getAttributes()); attributes.put(CoreAttributes.MIME_TYPE.key(), writer.getMimeType()); bundle.flowFile = getProcessSession().putAllAttributes(bundle.flowFile, attributes); } populateAttributes(bundle); return true; }
private boolean processBundle(final BundleTracker bundle) throws IOException { final RecordSetWriter writer = bundle.recordWriter; if (writer != null) { final WriteResult writeResult; try { writeResult = writer.finishRecordSet(); } finally { writer.close(); } if (writeResult.getRecordCount() == 0) { getProcessSession().remove(bundle.flowFile); return false; } final Map<String, String> attributes = new HashMap<>(); attributes.putAll(writeResult.getAttributes()); attributes.put(CoreAttributes.MIME_TYPE.key(), writer.getMimeType()); bundle.flowFile = getProcessSession().putAllAttributes(bundle.flowFile, attributes); } populateAttributes(bundle); return true; }
private boolean processBundle(final BundleTracker bundle) throws IOException { final RecordSetWriter writer = bundle.recordWriter; if (writer != null) { final WriteResult writeResult; try { writeResult = writer.finishRecordSet(); } finally { writer.close(); } if (writeResult.getRecordCount() == 0) { getProcessSession().remove(bundle.flowFile); return false; } final Map<String, String> attributes = new HashMap<>(); attributes.putAll(writeResult.getAttributes()); attributes.put(CoreAttributes.MIME_TYPE.key(), writer.getMimeType()); bundle.flowFile = getProcessSession().putAllAttributes(bundle.flowFile, attributes); } populateAttributes(bundle); return true; }
recordWriter.close(); logger.debug("Closed Record Writer using session {} for {}", new Object[] {session, this});
writer.close();
writer.close(); } catch (final IOException ioe) { getLogger().warn("Failed to close Writer for {}", new Object[] {childFlowFile}); tuple.getValue().close(); } catch (final Exception e1) { getLogger().warn("Failed to close Writer for {}; some resources may not be cleaned up appropriately", new Object[] {tuple.getKey()}); final RecordSetWriter writer = tuple.getValue(); try { writer.close(); } catch (final Exception e) { getLogger().warn("Failed to close Record Writer for {}; some resources may not be properly cleaned up", new Object[] {tuple.getKey(), e});
writer.close(); } catch (IOException e) { logger.warn("Failed to close Record Writer due to {}" + e, e);
recordSetWriter.close(); } catch (final IOException ioe) { getLogger().warn("Failed to close Writer for {}", new Object[] {outFlowFile});
recordWriter.close();
writer.close(); out.close(); attributes.put("record.count", String.valueOf(count));