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.server.nodemanager;
20 
21 import java.util.List;
22 
23 import org.apache.hadoop.yarn.api.records.ContainerId;
24 
25 public class CMgrCompletedContainersEvent extends ContainerManagerEvent {
26 
27   private final List<ContainerId> containerToCleanup;
28   private final Reason reason;
29 
CMgrCompletedContainersEvent(List<ContainerId> containersToCleanup, Reason reason)30   public CMgrCompletedContainersEvent(List<ContainerId> containersToCleanup,
31                                       Reason reason) {
32     super(ContainerManagerEventType.FINISH_CONTAINERS);
33     this.containerToCleanup = containersToCleanup;
34     this.reason = reason;
35   }
36 
getContainersToCleanup()37   public List<ContainerId> getContainersToCleanup() {
38     return this.containerToCleanup;
39   }
40 
getReason()41   public Reason getReason() {
42     return reason;
43   }
44 
45   public static enum Reason {
46     /**
47      * Container is killed as NodeManager is shutting down
48      */
49     ON_SHUTDOWN,
50 
51     /**
52      * Container is killed as the Nodemanager is re-syncing with the
53      * ResourceManager
54      */
55     ON_NODEMANAGER_RESYNC,
56 
57     /**
58      * Container is killed on request by the ResourceManager
59      */
60     BY_RESOURCEMANAGER
61   }
62 
63 }
64