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, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.yarn.api.protocolrecords;
020
021import org.apache.hadoop.classification.InterfaceAudience.Private;
022import org.apache.hadoop.classification.InterfaceAudience.Public;
023import org.apache.hadoop.classification.InterfaceStability.Stable;
024import org.apache.hadoop.classification.InterfaceStability.Unstable;
025import org.apache.hadoop.yarn.api.records.ReservationId;
026import org.apache.hadoop.yarn.util.Records;
027
028/**
029 * <p>The response sent by the <code>ResourceManager</code> to the client for
030 * a request to get a new {@link ReservationId} for submitting reservations.</p>
031 *
032 * <p>Clients can submit an reservation with the returned
033 * {@link ReservationId}.</p>
034 *
035 * {@code ApplicationClientProtocol#getNewReservation(GetNewReservationRequest)}
036 */
037@Public
038@Unstable
039public abstract class GetNewReservationResponse {
040
041  @Private
042  @Unstable
043  public static GetNewReservationResponse newInstance(
044          ReservationId reservationId) {
045    GetNewReservationResponse response =
046        Records.newRecord(GetNewReservationResponse.class);
047    response.setReservationId(reservationId);
048    return response;
049  }
050
051  /**
052   * Get a new {@link ReservationId} to be used to submit a reservation.
053   *
054   * @return a {@link ReservationId} representing the unique id to identify
055   * a reservation with which it was submitted.
056   */
057  @Public
058  @Unstable
059  public abstract ReservationId getReservationId();
060
061  /**
062   * Set a new {@link ReservationId} to be used to submit a reservation.
063   *
064   * @param reservationId a {@link ReservationId} representing the unique id to
065   *          identify a reservation with which it was submitted.
066   */
067  @Private
068  @Unstable
069  public abstract void setReservationId(ReservationId reservationId);
070
071}