001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.reef.exception;
020
021import org.apache.reef.annotations.audience.DriverSide;
022import org.apache.reef.io.naming.Identifiable;
023
024import java.util.concurrent.ExecutionException;
025
026/**
027 * Exception thrown to the Driver when an Evaluator becomes unusable.
028 */
029@DriverSide
030public class EvaluatorException extends ExecutionException implements Identifiable {
031
032  private static final long serialVersionUID = 1L;
033  private final transient String evaluatorId;
034
035  public EvaluatorException(final String evaluatorId) {
036    super();
037    this.evaluatorId = evaluatorId;
038  }
039
040  public EvaluatorException(final String evaluatorId, final String message, final Throwable cause) {
041    super(message, cause);
042    this.evaluatorId = evaluatorId;
043  }
044
045  public EvaluatorException(final String evaluatorId, final String message) {
046    super(message);
047    this.evaluatorId = evaluatorId;
048  }
049
050
051  public EvaluatorException(final String evaluatorId, final Throwable cause) {
052    super(cause);
053    this.evaluatorId = evaluatorId;
054  }
055
056  /**
057   * Access the affected Evaluator.
058   *
059   * @return the affected Evaluator.
060   */
061  @Override
062  public String getId() {
063    return this.evaluatorId;
064  }
065
066}