From 7c550ccb092f1d17ad5e2c7a967d4461ff5a891e Mon Sep 17 00:00:00 2001 From: Vinod Kumar Vavilapalli Date: Wed, 17 Oct 2012 00:32:37 +0000 Subject: [PATCH] YARN-161. Fix multiple compiler warnings for unchecked operations in YARN common. Contributed by Chris Nauroth. svn merge --ignore-ancestry -c 1399056 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1399057 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../providers/RecordFactoryProvider.java | 2 +- .../factory/providers/RpcFactoryProvider.java | 2 +- .../YarnRemoteExceptionFactoryProvider.java | 2 +- .../yarn/state/StateMachineFactory.java | 22 ++++++++++--------- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 75808a71161..5f5973f36dd 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -127,6 +127,9 @@ Release 0.23.5 - UNRELEASED IMPROVEMENTS + YARN-161. Fix multiple compiler warnings for unchecked operations in YARN + common. (Chris Nauroth via vinodkv) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RecordFactoryProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RecordFactoryProvider.java index c94ff737b0f..66ed1592208 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RecordFactoryProvider.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RecordFactoryProvider.java @@ -58,7 +58,7 @@ public class RecordFactoryProvider { private static Object getFactoryClassInstance(String factoryClassName) { try { - Class clazz = Class.forName(factoryClassName); + Class clazz = Class.forName(factoryClassName); Method method = clazz.getMethod("get", null); method.setAccessible(true); return method.invoke(null, null); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RpcFactoryProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RpcFactoryProvider.java index d5c5ce1a895..1c6e1427ad0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RpcFactoryProvider.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RpcFactoryProvider.java @@ -73,7 +73,7 @@ public class RpcFactoryProvider { private static Object getFactoryClassInstance(String factoryClassName) { try { - Class clazz = Class.forName(factoryClassName); + Class clazz = Class.forName(factoryClassName); Method method = clazz.getMethod("get", null); method.setAccessible(true); return method.invoke(null, null); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/YarnRemoteExceptionFactoryProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/YarnRemoteExceptionFactoryProvider.java index 2cd9f12d922..e6e3b4353cb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/YarnRemoteExceptionFactoryProvider.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/YarnRemoteExceptionFactoryProvider.java @@ -51,7 +51,7 @@ public class YarnRemoteExceptionFactoryProvider { private static Object getFactoryClassInstance(String factoryClassName) { try { - Class clazz = Class.forName(factoryClassName); + Class clazz = Class.forName(factoryClassName); Method method = clazz.getMethod("get", null); method.setAccessible(true); return method.invoke(null, null); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/state/StateMachineFactory.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/state/StateMachineFactory.java index 71c829ac582..df6ef6ff4bf 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/state/StateMachineFactory.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/state/StateMachineFactory.java @@ -68,7 +68,7 @@ final public class StateMachineFactory private StateMachineFactory (StateMachineFactory that, - ApplicableTransition t) { + ApplicableTransition t) { this.defaultInitialState = that.defaultInitialState; this.transitionsListNode = new TransitionsListNode(t, that.transitionsListNode); @@ -96,11 +96,12 @@ final public class StateMachineFactory } private class TransitionsListNode { - final ApplicableTransition transition; + final ApplicableTransition transition; final TransitionsListNode next; TransitionsListNode - (ApplicableTransition transition, TransitionsListNode next) { + (ApplicableTransition transition, + TransitionsListNode next) { this.transition = transition; this.next = next; } @@ -225,8 +226,8 @@ final public class StateMachineFactory addTransition(STATE preState, STATE postState, EVENTTYPE eventType, SingleArcTransition hook){ - return new StateMachineFactory - (this, new ApplicableSingleOrMultipleTransition + return new StateMachineFactory + (this, new ApplicableSingleOrMultipleTransition (preState, eventType, new SingleInternalArc(postState, hook))); } @@ -248,9 +249,9 @@ final public class StateMachineFactory addTransition(STATE preState, Set postStates, EVENTTYPE eventType, MultipleArcTransition hook){ - return new StateMachineFactory + return new StateMachineFactory (this, - new ApplicableSingleOrMultipleTransition + new ApplicableSingleOrMultipleTransition (preState, eventType, new MultipleInternalArc(postStates, hook))); } @@ -273,7 +274,7 @@ final public class StateMachineFactory public StateMachineFactory installTopology() { - return new StateMachineFactory(this, true); + return new StateMachineFactory(this, true); } /** @@ -308,7 +309,8 @@ final public class StateMachineFactory } private void makeStateMachineTable() { - Stack stack = new Stack(); + Stack> stack = + new Stack>(); Map>> prototype = new HashMap>>(); @@ -469,7 +471,7 @@ final public class StateMachineFactory } else if (transition instanceof StateMachineFactory.MultipleInternalArc) { StateMachineFactory.MultipleInternalArc ma = (StateMachineFactory.MultipleInternalArc) transition; - Iterator iter = ma.validPostStates.iterator(); + Iterator iter = ma.validPostStates.iterator(); while (iter.hasNext()) { Graph.Node fromNode = g.getNode(startState.toString()); Graph.Node toNode = g.getNode(iter.next().toString());