Github user chandnisingh commented on a diff in the pull request:
https://github.com/apache/incubator-apex-core/pull/187#discussion_r47982690
--- Diff: api/src/main/java/com/datatorrent/api/Operator.java ---
@@ -270,4 +271,29 @@ public String toString()
}
+ /**
+ * Operators that need to be notified about checkpoint events should
implement this interface.
+ *
+ * The notification callbacks in this interface are called outside
window boundaries so the operators should not
+ * attempt to send any tuples in these callbacks.
+ *
+ */
+ public static interface CheckpointNotificationListener extends
CheckpointListener
+ {
+ /**
+ * Notify the operator that a checkpoint is about to be performed.
+ *
+ * Operators may need to perform certain tasks just before a
checkpoint such as calling flush on a stream. Having
+ * this notification helps operators perform such operations optimally
by doing them once before checkpoint as
+ * opposed to doing it repeatedly at the end of every window.
+ *
+ * The method will be called before the checkpoint is performed. It
will be called after
+ * {@link Operator#endWindow()} call of the window preceding the
checkpoint and before the checkpoint is
+ * actually performed.
+ *
+ * @param windowId The window id of the window preceding the checkpoint
+ */
+ public void checkpoint(long windowId);
--- End diff --
IMO it is needed with checkpoint as well. It signifies that state is going
to be persisted with respect to a particular window Id.
As mentioned before this window id is not the same as what the operator
caches in beginWindow(...) when checkpointing is happen between application
windows.
One use case is checkpoint being done incrementally.
It is consistent with checkpointed(windowId) callback.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---