Updated Branches: refs/heads/master 11ecaacf4 -> 8b58faa55
CRUNCH-59. Modify DoFn's documentation to differentiate between configure and initialize APIs. Signed-off-by: Vinod Kumar Vavilapalli <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-crunch/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-crunch/commit/8b58faa5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-crunch/tree/8b58faa5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-crunch/diff/8b58faa5 Branch: refs/heads/master Commit: 8b58faa5516a6d6db5833c8ba9289ca60cbc59c6 Parents: 11ecaac Author: Vinod Kumar Vavilapalli <[email protected]> Authored: Sun Sep 16 09:15:42 2012 -0700 Committer: Vinod Kumar Vavilapalli <[email protected]> Committed: Sun Sep 16 09:19:14 2012 -0700 ---------------------------------------------------------------------- crunch/src/main/java/org/apache/crunch/DoFn.java | 31 +++++++++++------ 1 files changed, 20 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/8b58faa5/crunch/src/main/java/org/apache/crunch/DoFn.java ---------------------------------------------------------------------- diff --git a/crunch/src/main/java/org/apache/crunch/DoFn.java b/crunch/src/main/java/org/apache/crunch/DoFn.java index 3d1e785..7d516de 100644 --- a/crunch/src/main/java/org/apache/crunch/DoFn.java +++ b/crunch/src/main/java/org/apache/crunch/DoFn.java @@ -42,9 +42,12 @@ public abstract class DoFn<S, T> implements Serializable { private transient String internalStatus; /** - * Called during the job planning phase. Subclasses may override this method - * in order to modify the configuration of the Job that this DoFn instance - * belongs to. + * Configure this DoFn. Subclasses may override this method to modify the + * configuration of the Job that this DoFn instance belongs to. + * + * <p> + * Called during the job planning phase by the crunch-client. + * </p> * * @param conf * The Configuration instance for the Job. @@ -53,6 +56,20 @@ public abstract class DoFn<S, T> implements Serializable { } /** + * Initialize this DoFn. This initialization will happen before the actual + * {@link #process(Object, Emitter)} is triggered. Subclasses may override + * this method to do appropriate initialization. + * + * <p> + * Called during the setup of the job instance this {@code DoFn} is + * associated with. + * </p> + * + */ + public void initialize() { + } + + /** * Processes the records from a {@link PCollection}. * * <br/> @@ -73,14 +90,6 @@ public abstract class DoFn<S, T> implements Serializable { public abstract void process(S input, Emitter<T> emitter); /** - * Called during the setup of the MapReduce job this {@code DoFn} is - * associated with. Subclasses may override this method to do appropriate - * initialization. - */ - public void initialize() { - } - - /** * Called during the cleanup of the MapReduce job this {@code DoFn} is * associated with. Subclasses may override this method to do appropriate * cleanup.
