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.protocolrecords;
020    
021    import java.util.List;
022    
023    import org.apache.hadoop.classification.InterfaceAudience.Public;
024    import org.apache.hadoop.classification.InterfaceStability.Stable;
025    import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
026    import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
027    import org.apache.hadoop.yarn.util.Records;
028    
029    /**
030     * <p>
031     * The request which contains a list of {@link StartContainerRequest} sent by
032     * the <code>ApplicationMaster</code> to the <code>NodeManager</code> to
033     * <em>start</em> containers.
034     * </p>
035     * 
036     * <p>
037     * In each {@link StartContainerRequest}, the <code>ApplicationMaster</code> has
038     * to provide details such as allocated resource capability, security tokens (if
039     * enabled), command to be executed to start the container, environment for the
040     * process, necessary binaries/jar/shared-objects etc. via the
041     * {@link ContainerLaunchContext}.
042     * </p>
043     * 
044     * @see ContainerManagementProtocol#startContainers(StartContainersRequest)
045     */
046    @Public
047    @Stable
048    public abstract class StartContainersRequest {
049    
050      @Public
051      @Stable
052      public static StartContainersRequest newInstance(
053          List<StartContainerRequest> requests) {
054        StartContainersRequest request =
055            Records.newRecord(StartContainersRequest.class);
056        request.setStartContainerRequests(requests);
057        return request;
058      }
059    
060      /**
061       * Get a list of {@link StartContainerRequest} to start containers.
062       * @return a list of {@link StartContainerRequest} to start containers.
063       */
064      @Public
065      @Stable
066      public abstract List<StartContainerRequest> getStartContainerRequests();
067    
068      /**
069       * Set a list of {@link StartContainerRequest} to start containers.
070       * @param request a list of {@link StartContainerRequest} to start containers
071       */
072      @Public
073      @Stable
074      public abstract void setStartContainerRequests(
075          List<StartContainerRequest> request);
076    }