markap14 commented on a change in pull request #5042:
URL: https://github.com/apache/nifi/pull/5042#discussion_r625975237
##########
File path: nifi-api/src/main/java/org/apache/nifi/processor/ProcessSession.java
##########
@@ -101,6 +102,105 @@
*/
void commit();
+ /**
+ * <p>
+ * Commits the current session ensuring all operations against FlowFiles
+ * within this session are atomically persisted. All FlowFiles operated on
+ * within this session must be accounted for by transfer or removal or the
+ * commit will fail.
+ * </p>
+ *
+ * <p>
+ * Unlike the {@link #commit()} method, the persistence of data to the
repositories is not
+ * guaranteed to have occurred by the time that this method returns.
Therefore, if any follow-on actions
+ * are necessary after the data has been persisted to the repository (for
example, acknowledging receipt from
+ * a source system, removing a source file, etc.) that logic should be
performed only by invoking {@link #commitAsync(Runnable, Consumer)}
+ * and implementing that action in the provided callback.
+ * </p>
+ *
+ * <p>
+ * If the session cannot be committed, an error will be logged and the
session will be rolled back instead.
+ * </p>
+ *
+ * @throws IllegalStateException if called from within a read or write
callback (See {@link #write(FlowFile, StreamCallback)}, {@link #write(FlowFile,
OutputStreamCallback)},
+ * {@link #read(FlowFile, InputStreamCallback)}).
+ *
+ * @throws FlowFileHandlingException if any FlowFile is not appropriately
accounted for by transferring it to a Relationship (see {@link
#transfer(FlowFile, Relationship)})
+ * or removed (see {@link #remove(FlowFile)}.
+ */
+ void commitAsync();
+
+ /**
+ * <p>
+ * Commits the current session ensuring all operations against FlowFiles
+ * within this session are atomically persisted. All FlowFiles operated on
+ * within this session must be accounted for by transfer or removal or the
+ * commit will fail.
+ * </p>
+ *
+ * <p>
+ * Unlike the {@link #commit()} method, the persistence of data to the
repositories is not
Review comment:
Ahhh I see. The commit says that it cannot be reused. After I did some
refactoring, that statement is no longer accurate. It is safe to reuse. I will
update documentation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]