YARN-6908. ResourceProfilesManagerImpl is missing @Overrides on methods

(Contributed by Sunil G. via Daniel Templeton)
This commit is contained in:
Daniel Templeton 2017-08-16 09:41:52 -07:00 committed by Wangda Tan
parent 2b51b262ab
commit 6746f8cadb
2 changed files with 41 additions and 0 deletions

View File

@ -18,6 +18,8 @@
package org.apache.hadoop.yarn.server.resourcemanager.resource; package org.apache.hadoop.yarn.server.resourcemanager.resource;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.Resource;
@ -28,19 +30,51 @@
* Interface for the resource profiles manager. Provides an interface to get * Interface for the resource profiles manager. Provides an interface to get
* the list of available profiles and some helper functions. * the list of available profiles and some helper functions.
*/ */
@Public
@Unstable
public interface ResourceProfilesManager { public interface ResourceProfilesManager {
/**
* Method to handle all initialization steps for ResourceProfilesManager.
* @param config Configuration object
* @throws IOException when invalid resource profile names are loaded
*/
void init(Configuration config) throws IOException; void init(Configuration config) throws IOException;
/**
* Get the resource capability associated with given profile name.
* @param profile name of resource profile
* @return resource capability for given profile
*/
Resource getProfile(String profile); Resource getProfile(String profile);
/**
* Get all supported resource profiles.
* @return a map of resource objects associated with each profile
*/
Map<String, Resource> getResourceProfiles(); Map<String, Resource> getResourceProfiles();
/**
* Reload profiles based on updated configuration.
* @throws IOException when invalid resource profile names are loaded
*/
void reloadProfiles() throws IOException; void reloadProfiles() throws IOException;
/**
* Get default supported resource profile.
* @return resource object which is default
*/
Resource getDefaultProfile(); Resource getDefaultProfile();
/**
* Get minimum supported resource profile.
* @return resource object which is minimum
*/
Resource getMinimumProfile(); Resource getMinimumProfile();
/**
* Get maximum supported resource profile.
* @return resource object which is maximum
*/
Resource getMaximumProfile(); Resource getMaximumProfile();
} }

View File

@ -56,6 +56,7 @@ public class ResourceProfilesManagerImpl implements ResourceProfilesManager {
private static final String[] MANDATORY_PROFILES = private static final String[] MANDATORY_PROFILES =
{ DEFAULT_PROFILE, MINIMUM_PROFILE, MAXIMUM_PROFILE }; { DEFAULT_PROFILE, MINIMUM_PROFILE, MAXIMUM_PROFILE };
@Override
public void init(Configuration config) throws IOException { public void init(Configuration config) throws IOException {
conf = config; conf = config;
loadProfiles(); loadProfiles();
@ -146,28 +147,34 @@ private Resource parseResource(Map profileInfo) throws IOException {
return resource; return resource;
} }
@Override
public Resource getProfile(String profile) { public Resource getProfile(String profile) {
return Resources.clone(profiles.get(profile)); return Resources.clone(profiles.get(profile));
} }
@Override
public Map<String, Resource> getResourceProfiles() { public Map<String, Resource> getResourceProfiles() {
return Collections.unmodifiableMap(profiles); return Collections.unmodifiableMap(profiles);
} }
@Override
@VisibleForTesting @VisibleForTesting
public void reloadProfiles() throws IOException { public void reloadProfiles() throws IOException {
profiles.clear(); profiles.clear();
loadProfiles(); loadProfiles();
} }
@Override
public Resource getDefaultProfile() { public Resource getDefaultProfile() {
return getProfile(DEFAULT_PROFILE); return getProfile(DEFAULT_PROFILE);
} }
@Override
public Resource getMinimumProfile() { public Resource getMinimumProfile() {
return getProfile(MINIMUM_PROFILE); return getProfile(MINIMUM_PROFILE);
} }
@Override
public Resource getMaximumProfile() { public Resource getMaximumProfile() {
return getProfile(MAXIMUM_PROFILE); return getProfile(MAXIMUM_PROFILE);
} }