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.Unstable; 024import org.apache.hadoop.yarn.api.records.ReservationDefinition; 025import org.apache.hadoop.yarn.api.records.ReservationId; 026import org.apache.hadoop.yarn.util.Records; 027 028/** 029 * {@link ReservationSubmissionResponse} contains the answer of the admission 030 * control system in the {@code ResourceManager} to a reservation create 031 * operation. Response contains a {@link ReservationId} if the operation was 032 * successful, if not an exception reporting reason for a failure. 033 * 034 * @see ReservationDefinition 035 * 036 */ 037@Public 038@Unstable 039public abstract class ReservationSubmissionResponse { 040 041 @Private 042 @Unstable 043 public static ReservationSubmissionResponse newInstance( 044 ReservationId reservationId) { 045 ReservationSubmissionResponse response = 046 Records.newRecord(ReservationSubmissionResponse.class); 047 response.setReservationId(reservationId); 048 return response; 049 } 050 051 /** 052 * Get the {@link ReservationId}, that corresponds to a valid resource 053 * allocation in the scheduler (between start and end time of this 054 * reservation) 055 * 056 * @return the {@link ReservationId} representing the unique id of the 057 * corresponding reserved resource allocation in the scheduler 058 */ 059 @Public 060 @Unstable 061 public abstract ReservationId getReservationId(); 062 063 /** 064 * Set the {@link ReservationId}, that correspond to a valid resource 065 * allocation in the scheduler (between start and end time of this 066 * reservation) 067 * 068 * @param reservationId the {@link ReservationId} representing the the unique 069 * id of the corresponding reserved resource allocation in the 070 * scheduler 071 */ 072 @Private 073 @Unstable 074 public abstract void setReservationId(ReservationId reservationId); 075 076}