You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2015/11/01 12:49:22 UTC
[10/14] incubator-slider git commit: SLIDER-82 IDE suggested AM
cleanup
SLIDER-82 IDE suggested AM cleanup
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/88a7b34c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/88a7b34c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/88a7b34c
Branch: refs/heads/develop
Commit: 88a7b34cacbbe7b092b7c02dbe1e653772fc441e
Parents: e2d8ab0
Author: Steve Loughran <st...@apache.org>
Authored: Mon Oct 19 11:09:10 2015 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Mon Oct 19 11:15:53 2015 +0100
----------------------------------------------------------------------
.../server/appmaster/SliderAppMaster.java | 35 ++++++--------------
.../apache/slider/test/SliderTestUtils.groovy | 10 +++---
2 files changed, 17 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/88a7b34c/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index 92b602f..777fa04 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -574,11 +574,10 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
String action = serviceArgs.getAction();
List<String> actionArgs = serviceArgs.getActionArgs();
int exitCode;
-/* JDK7
- switch (action) {
+ switch (action) {
case SliderActions.ACTION_HELP:
- log.info(getName() + serviceArgs.usage());
- exitCode = LauncherExitCodes.EXIT_USAGE;
+ log.info("{}: {}", getName(), serviceArgs.usage());
+ exitCode = SliderExitCodes.EXIT_USAGE;
break;
case SliderActions.ACTION_CREATE:
exitCode = createAndRunCluster(actionArgs.get(0));
@@ -586,20 +585,10 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
default:
throw new SliderException("Unimplemented: " + action);
}
- */
- if (action.equals(SliderActions.ACTION_HELP)) {
- log.info("{}: {}", getName(), serviceArgs.usage());
- exitCode = SliderExitCodes.EXIT_USAGE;
- } else if (action.equals(SliderActions.ACTION_CREATE)) {
- exitCode = createAndRunCluster(actionArgs.get(0));
- } else {
- throw new SliderException("Unimplemented: " + action);
- }
log.info("Exiting AM; final exit code = {}", exitCode);
return exitCode;
}
-
/**
* Initialize a newly created service then add it.
* Because the service is not started, this MUST be done before
@@ -705,23 +694,22 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
Map<String, String> envVars;
List<Container> liveContainers;
-
- /**
+
+ /*
* It is critical this section is synchronized, to stop async AM events
* arriving while registering a restarting AM.
*/
synchronized (appState) {
int heartbeatInterval = HEARTBEAT_INTERVAL;
- //add the RM client -this brings the callbacks in
- asyncRMClient = AMRMClientAsync.createAMRMClientAsync(heartbeatInterval,
- this);
+ // add the RM client -this brings the callbacks in
+ asyncRMClient = AMRMClientAsync.createAMRMClientAsync(heartbeatInterval, this);
addService(asyncRMClient);
//now bring it up
deployChildService(asyncRMClient);
- //nmclient relays callbacks back to this class
+ // nmclient relays callbacks back to this class
nmClientAsync = new NMClientAsyncImpl("nmclient", this);
deployChildService(nmClientAsync);
@@ -756,8 +744,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
log.info(registryOperations.toString());
//build the role map
- List<ProviderRole> providerRoles =
- new ArrayList<ProviderRole>(providerService.getRoles());
+ List<ProviderRole> providerRoles = new ArrayList<>(providerService.getRoles());
providerRoles.addAll(SliderAMClientProvider.ROLES);
// Start up the WebApp and track the URL for it
@@ -1020,7 +1007,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
// up to date token for container launches (getContainerCredentials()).
UserGroupInformation currentUser = UserGroupInformation.getCurrentUser();
Credentials credentials = currentUser.getCredentials();
- List<Text> filteredTokens = new ArrayList<Text>();
+ List<Text> filteredTokens = new ArrayList<>();
filteredTokens.add(AMRMTokenIdentifier.KIND_NAME);
boolean keytabProvided = securityConfiguration.isKeytabProvided();
@@ -1942,7 +1929,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
protected synchronized void launchProviderService(AggregateConf instanceDefinition,
File confDir)
throws IOException, SliderException {
- Map<String, String> env = new HashMap<String, String>();
+ Map<String, String> env = new HashMap<>();
boolean execStarted = providerService.exec(instanceDefinition, confDir, env,
this);
if (execStarted) {
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/88a7b34c/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
index 5de6aba..ae07187 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
@@ -683,14 +683,18 @@ class SliderTestUtils extends Assert {
* to have been called.
*
* @param path path to page
- * @param connectionChecks optional closure to run against an open connection
* @return body of response
*/
- public static String getWebPage(String path, Closure connectionChecks = null) {
+ public static String getWebPage(String path) {
HttpOperationResponse outcome = executeGet(path)
return new String(outcome.data);
}
+ /**
+ * Execute a GET operation
+ * @param path path to GET
+ * @return the response
+ */
public static HttpOperationResponse executeGet(String path) {
assert path
assertHttpSupportInitialized()
@@ -1477,6 +1481,4 @@ class SliderTestUtils extends Assert {
}
}
-
-
}