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 java.util.List; 022 023import org.apache.hadoop.classification.InterfaceAudience.Public; 024import org.apache.hadoop.classification.InterfaceStability.Unstable; 025import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol; 026import org.apache.hadoop.yarn.api.records.ContainerReport; 027import org.apache.hadoop.yarn.util.Records; 028 029/** 030 * <p> 031 * The response sent by the <code>ResourceManager</code> to a client requesting 032 * a list of {@link ContainerReport} for containers. 033 * </p> 034 * 035 * <p> 036 * The <code>ContainerReport</code> for each container includes the container 037 * details. 038 * </p> 039 * 040 * @see ContainerReport 041 * @see ApplicationHistoryProtocol#getContainers(GetContainersRequest) 042 */ 043@Public 044@Unstable 045public abstract class GetContainersResponse { 046 047 @Public 048 @Unstable 049 public static GetContainersResponse newInstance( 050 List<ContainerReport> containers) { 051 GetContainersResponse response = 052 Records.newRecord(GetContainersResponse.class); 053 response.setContainerList(containers); 054 return response; 055 } 056 057 /** 058 * Get a list of <code>ContainerReport</code> for all the containers of an 059 * application attempt. 060 * 061 * @return a list of <code>ContainerReport</code> for all the containers of an 062 * application attempt 063 * 064 */ 065 @Public 066 @Unstable 067 public abstract List<ContainerReport> getContainerList(); 068 069 /** 070 * Set a list of <code>ContainerReport</code> for all the containers of an 071 * application attempt. 072 * 073 * @param containers 074 * a list of <code>ContainerReport</code> for all the containers of 075 * an application attempt 076 * 077 */ 078 @Public 079 @Unstable 080 public abstract void setContainerList(List<ContainerReport> containers); 081}