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 org.apache.hadoop.classification.InterfaceAudience.Public; 022 import org.apache.hadoop.classification.InterfaceStability.Stable; 023 import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; 024 import org.apache.hadoop.yarn.util.Records; 025 026 /** 027 * <p>The request sent by the <code>ApplicationMaster</code> to 028 * <code>ResourceManager</code> on registration.</p> 029 * 030 * <p>The registration includes details such as: 031 * <ul> 032 * <li>Hostname on which the AM is running.</li> 033 * <li>RPC Port</li> 034 * <li>Tracking URL</li> 035 * </ul> 036 * </p> 037 * 038 * @see ApplicationMasterProtocol#registerApplicationMaster(RegisterApplicationMasterRequest) 039 */ 040 @Public 041 @Stable 042 public abstract class RegisterApplicationMasterRequest { 043 044 /** 045 * Create a new instance of <code>RegisterApplicationMasterRequest</code>. 046 * If <em>port, trackingUrl</em> is not used, use the following default value: 047 * <ul> 048 * <li>port: -1</li> 049 * <li>trackingUrl: null</li> 050 * </ul> 051 * @return the new instance of <code>RegisterApplicationMasterRequest</code> 052 */ 053 @Public 054 @Stable 055 public static RegisterApplicationMasterRequest newInstance(String host, 056 int port, String trackingUrl) { 057 RegisterApplicationMasterRequest request = 058 Records.newRecord(RegisterApplicationMasterRequest.class); 059 request.setHost(host); 060 request.setRpcPort(port); 061 request.setTrackingUrl(trackingUrl); 062 return request; 063 } 064 065 /** 066 * Get the <em>host</em> on which the <code>ApplicationMaster</code> is 067 * running. 068 * @return <em>host</em> on which the <code>ApplicationMaster</code> is running 069 */ 070 @Public 071 @Stable 072 public abstract String getHost(); 073 074 /** 075 * Set the <em>host</em> on which the <code>ApplicationMaster</code> is 076 * running. 077 * @param host <em>host</em> on which the <code>ApplicationMaster</code> 078 * is running 079 */ 080 @Public 081 @Stable 082 public abstract void setHost(String host); 083 084 /** 085 * Get the <em>RPC port</em> on which the <code>ApplicationMaster</code> 086 * is responding. 087 * @return the <em>RPC port<em> on which the <code>ApplicationMaster</code> is 088 * responding 089 */ 090 @Public 091 @Stable 092 public abstract int getRpcPort(); 093 094 /** 095 * Set the <em>RPC port<em> on which the <code>ApplicationMaster</code> is 096 * responding. 097 * @param port <em>RPC port<em> on which the <code>ApplicationMaster</code> is 098 * responding 099 */ 100 @Public 101 @Stable 102 public abstract void setRpcPort(int port); 103 104 /** 105 * Get the <em>tracking URL</em> for the <code>ApplicationMaster</code>. 106 * @return <em>tracking URL</em> for the <code>ApplicationMaster</code> 107 */ 108 @Public 109 @Stable 110 public abstract String getTrackingUrl(); 111 112 /** 113 * Set the <em>tracking URL</em> for the <code>ApplicationMaster</code>. 114 * @param trackingUrl <em>tracking URL</em> for the 115 * <code>ApplicationMaster</code> 116 */ 117 @Public 118 @Stable 119 public abstract void setTrackingUrl(String trackingUrl); 120 }