    001/*
    002 * Copyright (c) 2007-2016 Concurrent, Inc. All Rights Reserved.
    003 *
    004 * Project and contact information: http://www.cascading.org/
    005 *
    006 * This file is part of the Cascading project.
    007 *
    008 * Licensed under the Apache License, Version 2.0 (the "License");
    009 * you may not use this file except in compliance with the License.
    010 * You may obtain a copy of the License at
    011 *
    012 *     http://www.apache.org/licenses/LICENSE-2.0
    013 *
    014 * Unless required by applicable law or agreed to in writing, software
    015 * distributed under the License is distributed on an "AS IS" BASIS,
    016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    017 * See the License for the specific language governing permissions and
    018 * limitations under the License.
    019 */
    020
    021package cascading.flow;
    022
    023/** Interface FlowStepListener provides hooks for receiving events on various stages of a {@link FlowStep} execution. */
    024public interface FlowStepListener
    025  {
    026  /**
    027   * The onStarting event is fired when a  given {@link cascading.flow.FlowStep} job has been submitted i.e. to hadoop cluster
    028   *
    029   * @param flowStep
    030   */
    031  public void onStepStarting( FlowStep flowStep );
    032
    033  /**
    034   * The onStepStopping event is fired when a given {@link cascading.flow.FlowStep} job is stopped
    035   *
    036   * @param flowStep
    037   */
    038  public void onStepStopping( FlowStep flowStep );
    039
    040  /**
    041   * The onStepRunning event is fired when a given {@link cascading.flow.FlowStep} moves into the running state
    042   *
    043   * @param flowStep
    044   */
    045  public void onStepRunning( FlowStep flowStep );
    046
    047  /**
    048   * The onStepCompleted event is fired when a flowStepJob completed its work
    049   *
    050   * @param flowStep
    051   */
    052  public void onStepCompleted( FlowStep flowStep );
    053
    054  /**
    055   * The onStepThrowable event is fired if a given {@link cascading.flow.FlowStep} throws a Throwable type. This throwable is passed
    056   * as an argument to the event. This event method should return true if the given throwable was handled and should
    057   * not be rethrown from the {@link Flow#complete()} method.
    058   *
    059   * @param flowStep
    060   * @param throwable
    061   * @return returns true if this listener has handled the given throwable
    062   */
    063  public boolean onStepThrowable( FlowStep flowStep, Throwable throwable );
    064  }