SLIDER-799 quick code review of this while looking @ log aggregation setup
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/06ac342f Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/06ac342f Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/06ac342f Branch: refs/heads/feature/SLIDER-799-AM-managed-relax Commit: 06ac342fc86da22f3fbbec8fbaabd2c57c77ace7 Parents: 1624bdf Author: Steve Loughran <ste...@apache.org> Authored: Wed Mar 18 10:51:22 2015 +0000 Committer: Steve Loughran <ste...@apache.org> Committed: Wed Mar 18 10:51:22 2015 +0000 ---------------------------------------------------------------------- .../slider/core/launch/AbstractLauncher.java | 19 +++++++++---------- .../slider/core/launch/AppMasterLauncher.java | 6 +++--- .../slider/core/launch/ClasspathConstructor.java | 2 +- .../slider/core/launch/CommandLineBuilder.java | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/06ac342f/slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java b/slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java index 3051c0b..3b12877 100644 --- a/slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java +++ b/slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java @@ -57,6 +57,7 @@ public abstract class AbstractLauncher extends Configured { private static final Logger log = LoggerFactory.getLogger(AbstractLauncher.class); public static final String CLASSPATH = "CLASSPATH"; + public static final String MAPREDUCE_JOB_CREDENTIALS_BINARY = "mapreduce.job.credentials.binary"; /** * Filesystem to use for the launch */ @@ -64,15 +65,13 @@ public abstract class AbstractLauncher extends Configured { /** * Env vars; set up at final launch stage */ - protected final Map<String, String> envVars = new HashMap<String, String>(); + protected final Map<String, String> envVars = new HashMap<>(); protected final MapOperations env = new MapOperations("env", envVars); protected final ContainerLaunchContext containerLaunchContext = Records.newRecord(ContainerLaunchContext.class); - protected final List<String> commands = new ArrayList<String>(20); - protected final Map<String, LocalResource> localResources = - new HashMap<String, LocalResource>(); - private final Map<String, ByteBuffer> serviceData = - new HashMap<String, ByteBuffer>(); + protected final List<String> commands = new ArrayList<>(20); + protected final Map<String, LocalResource> localResources = new HashMap<>(); + private final Map<String, ByteBuffer> serviceData = new HashMap<>(); // security protected final Credentials credentials = new Credentials(); protected LogAggregationContext logAggregationContext; @@ -84,7 +83,7 @@ public abstract class AbstractLauncher extends Configured { this.coreFileSystem = fs; } - public AbstractLauncher(CoreFileSystem fs) { + protected AbstractLauncher(CoreFileSystem fs) { this.coreFileSystem = fs; } @@ -212,7 +211,7 @@ public abstract class AbstractLauncher extends Configured { log.debug("{} tokens", credentials.numberOfTokens()); DataOutputBuffer dob = new DataOutputBuffer(); String tokenFileName = - this.getConf().get("mapreduce.job.credentials.binary"); + this.getConf().get(MAPREDUCE_JOB_CREDENTIALS_BINARY); if (tokenFileName != null) { // use delegation tokens, i.e. from Oozie Credentials creds = @@ -285,7 +284,7 @@ public abstract class AbstractLauncher extends Configured { String logPatternJoinStr = "|"; MapOperations options = new MapOperations("", map); - List<String> logIncludePatterns = new ArrayList<String>(); + List<String> logIncludePatterns = new ArrayList<>(); String includePatternExpression = options.getOption( ResourceKeys.YARN_LOG_INCLUDE_PATTERNS, "").trim(); if (!includePatternExpression.isEmpty()) { @@ -302,7 +301,7 @@ public abstract class AbstractLauncher extends Configured { logPatternJoinStr); log.info("Log include patterns: {}", logIncludePattern); - List<String> logExcludePatterns = new ArrayList<String>(); + List<String> logExcludePatterns = new ArrayList<>(); String excludePatternExpression = options.getOption( ResourceKeys.YARN_LOG_EXCLUDE_PATTERNS, "").trim(); if (!excludePatternExpression.isEmpty()) { http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/06ac342f/slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java b/slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java index 740badd..b4ca791 100644 --- a/slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java +++ b/slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java @@ -221,7 +221,7 @@ public class AppMasterLauncher extends AbstractLauncher { Token<? extends TokenIdentifier>[] tokens = null; boolean tokensProvided = - this.getConf().get("mapreduce.job.credentials.binary") != null; + this.getConf().get(MAPREDUCE_JOB_CREDENTIALS_BINARY) != null; if (!tokensProvided) { // For now, only getting tokens for the default file-system. FileSystem fs = coreFileSystem.getFileSystem(); @@ -239,8 +239,8 @@ public class AppMasterLauncher extends AbstractLauncher { if (!tokensProvided) { log.warn("No HDFS delegation tokens obtained for AM launch context"); } else { - log.info("Tokens provided via mapreduce.job.credentials.binary property " - + "being leveraged for AM launch"); + log.info("Tokens provided via "+ MAPREDUCE_JOB_CREDENTIALS_BINARY +" property " + + "being used for AM launch"); } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/06ac342f/slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java b/slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java index f474ffd..3ba0181 100644 --- a/slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java +++ b/slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java @@ -39,7 +39,7 @@ public class ClasspathConstructor { public static final String CLASS_PATH_SEPARATOR = ApplicationConstants.CLASS_PATH_SEPARATOR; // public static final String CLASS_PATH_SEPARATOR = File.pathSeparator; - private final List<String> pathElements = new ArrayList<String>(); + private final List<String> pathElements = new ArrayList<>(); public ClasspathConstructor() { } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/06ac342f/slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java b/slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java index f50bb48..dbaa981 100644 --- a/slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java +++ b/slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java @@ -30,7 +30,7 @@ import java.util.List; * Special support for JVM command buildup. */ public class CommandLineBuilder { - protected final List<String> argumentList = new ArrayList<String>(20); + protected final List<String> argumentList = new ArrayList<>(20); /**