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    
019    package org.apache.hadoop.yarn.api.records;
020    
021    import org.apache.hadoop.classification.InterfaceAudience.Public;
022    import org.apache.hadoop.classification.InterfaceStability.Unstable;
023    import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
024    import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
025    import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
026    import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException;
027    import org.apache.hadoop.yarn.exceptions.ApplicationMasterNotRegisteredException;
028    
029    /**
030     * Command sent by the Resource Manager to the Application Master in the 
031     * AllocateResponse 
032     * @see AllocateResponse
033     */
034    @Public
035    @Unstable
036    public enum AMCommand {
037    
038      /**
039       * @deprecated Sent by Resource Manager when it is out of sync with the AM and
040       *             wants the AM get back in sync.
041       * 
042       *             Note: Instead of sending this command,
043       *             {@link ApplicationMasterNotRegisteredException} will be thrown
044       *             when ApplicationMaster is out of sync with ResourceManager and
045       *             ApplicationMaster is expected to re-register with RM by calling
046       *             {@link ApplicationMasterProtocol#registerApplicationMaster(RegisterApplicationMasterRequest)}
047       */
048      AM_RESYNC,
049    
050      /**
051       * @deprecated Sent by Resource Manager when it wants the AM to shutdown.
052       *             Note: This command was earlier sent by ResourceManager to
053       *             instruct AM to shutdown if RM had restarted. Now
054       *             {@link ApplicationAttemptNotFoundException} will be thrown in case
055       *             that RM has restarted and AM is supposed to handle this
056       *             exception by shutting down itself.
057       */
058      AM_SHUTDOWN
059    }