1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 package org.apache.hadoop.yarn.api.protocolrecords;
20 
21 import org.apache.hadoop.classification.InterfaceAudience.Private;
22 import org.apache.hadoop.classification.InterfaceAudience.Public;
23 import org.apache.hadoop.classification.InterfaceStability.Stable;
24 import org.apache.hadoop.classification.InterfaceStability.Unstable;
25 import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
26 import org.apache.hadoop.yarn.util.Records;
27 
28 /**
29  * The response sent by the <code>ResourceManager</code> to the client aborting
30  * a submitted application.
31  * <p>
32  * The response, includes:
33  * <ul>
34  *   <li>
35  *     A flag which indicates that the process of killing the application is
36  *     completed or not.
37  *   </li>
38  * </ul>
39  * Note: user is recommended to wait until this flag becomes true, otherwise if
40  * the <code>ResourceManager</code> crashes before the process of killing the
41  * application is completed, the <code>ResourceManager</code> may retry this
42  * application on recovery.
43  *
44  * @see ApplicationClientProtocol#forceKillApplication(KillApplicationRequest)
45  */
46 @Public
47 @Stable
48 public abstract class KillApplicationResponse {
49   @Private
50   @Unstable
newInstance(boolean isKillCompleted)51   public static KillApplicationResponse newInstance(boolean isKillCompleted) {
52     KillApplicationResponse response =
53         Records.newRecord(KillApplicationResponse.class);
54     response.setIsKillCompleted(isKillCompleted);
55     return response;
56   }
57 
58   /**
59    * Get the flag which indicates that the process of killing application is completed or not.
60    */
61   @Public
62   @Stable
getIsKillCompleted()63   public abstract boolean getIsKillCompleted();
64 
65   /**
66    * Set the flag which indicates that the process of killing application is completed or not.
67    */
68   @Private
69   @Unstable
setIsKillCompleted(boolean isKillCompleted)70   public abstract void setIsKillCompleted(boolean isKillCompleted);
71 }
72