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.Public;
022import org.apache.hadoop.classification.InterfaceStability.Unstable;
023import org.apache.hadoop.classification.InterfaceStability.Evolving;
024import org.apache.hadoop.yarn.api.records.ContainerId;
025import org.apache.hadoop.yarn.api.records.SignalContainerCommand;
026import org.apache.hadoop.yarn.util.Records;
027
028/**
029 * <p>The request sent by the client to the <code>ResourceManager</code>
030 * or by the <code>ApplicationMaster</code> to the <code>NodeManager</code>
031 * to signal a container.
032 * @see SignalContainerCommand </p>
033 */
034@Public
035@Evolving
036public abstract class SignalContainerRequest {
037
038  @Public
039  @Unstable
040  public static SignalContainerRequest newInstance(ContainerId containerId,
041      SignalContainerCommand signalContainerCommand) {
042    SignalContainerRequest request =
043        Records.newRecord(SignalContainerRequest.class);
044    request.setContainerId(containerId);
045    request.setCommand(signalContainerCommand);
046    return request;
047  }
048
049  /**
050   * Get the <code>ContainerId</code> of the container to signal.
051   * @return <code>ContainerId</code> of the container to signal.
052   */
053  @Public
054  @Unstable
055  public abstract ContainerId getContainerId();
056
057  /**
058   * Set the <code>ContainerId</code> of the container to signal.
059   */
060  @Public
061  @Unstable
062  public abstract void setContainerId(ContainerId containerId);
063
064  /**
065   * Get the <code>SignalContainerCommand</code> of the signal request.
066   * @return <code>SignalContainerCommand</code> of the signal request.
067   */
068  @Public
069  @Unstable
070  public abstract SignalContainerCommand getCommand();
071
072  /**
073   * Set the <code>SignalContainerCommand</code> of the signal request.
074   */
075  @Public
076  @Unstable
077  public abstract void setCommand(SignalContainerCommand command);
078}