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.Stable;
025import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
026import org.apache.hadoop.yarn.api.records.ContainerId;
027import org.apache.hadoop.yarn.util.Records;
028
029/**
030 * <p>The request sent by the <code>ApplicationMaster</code> to the
031 * <code>NodeManager</code> to <em>stop</em> containers.</p>
032 * 
033 * @see ContainerManagementProtocol#stopContainers(StopContainersRequest)
034 */
035@Public
036@Stable
037public abstract class StopContainersRequest {
038
039  @Public
040  @Stable
041  public static StopContainersRequest newInstance(List<ContainerId> containerIds) {
042    StopContainersRequest request =
043        Records.newRecord(StopContainersRequest.class);
044    request.setContainerIds(containerIds);
045    return request;
046  }
047
048  /**
049   * Get the <code>ContainerId</code>s of the containers to be stopped.
050   * @return <code>ContainerId</code>s of containers to be stopped
051   */
052  @Public
053  @Stable
054  public abstract List<ContainerId> getContainerIds();
055  
056  /**
057   * Set the <code>ContainerId</code>s of the containers to be stopped.
058   * @param containerIds <code>ContainerId</code>s of the containers to be stopped
059   */
060  @Public
061  @Stable
062  public abstract void setContainerIds(List<ContainerId> containerIds);
063}