YARN-161. Fix multiple compiler warnings for unchecked operations in YARN common. Contributed by Chris Nauroth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1399056 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2012-10-17 00:31:51 +00:00
parent 0e9f40df97
commit 21b8d7b1fd
5 changed files with 18 additions and 13 deletions

View File

@ -145,6 +145,9 @@ Release 0.23.5 - UNRELEASED
IMPROVEMENTS IMPROVEMENTS
YARN-161. Fix multiple compiler warnings for unchecked operations in YARN
common. (Chris Nauroth via vinodkv)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -58,7 +58,7 @@ public class RecordFactoryProvider {
private static Object getFactoryClassInstance(String factoryClassName) { private static Object getFactoryClassInstance(String factoryClassName) {
try { try {
Class clazz = Class.forName(factoryClassName); Class<?> clazz = Class.forName(factoryClassName);
Method method = clazz.getMethod("get", null); Method method = clazz.getMethod("get", null);
method.setAccessible(true); method.setAccessible(true);
return method.invoke(null, null); return method.invoke(null, null);

View File

@ -73,7 +73,7 @@ public class RpcFactoryProvider {
private static Object getFactoryClassInstance(String factoryClassName) { private static Object getFactoryClassInstance(String factoryClassName) {
try { try {
Class clazz = Class.forName(factoryClassName); Class<?> clazz = Class.forName(factoryClassName);
Method method = clazz.getMethod("get", null); Method method = clazz.getMethod("get", null);
method.setAccessible(true); method.setAccessible(true);
return method.invoke(null, null); return method.invoke(null, null);

View File

@ -51,7 +51,7 @@ public class YarnRemoteExceptionFactoryProvider {
private static Object getFactoryClassInstance(String factoryClassName) { private static Object getFactoryClassInstance(String factoryClassName) {
try { try {
Class clazz = Class.forName(factoryClassName); Class<?> clazz = Class.forName(factoryClassName);
Method method = clazz.getMethod("get", null); Method method = clazz.getMethod("get", null);
method.setAccessible(true); method.setAccessible(true);
return method.invoke(null, null); return method.invoke(null, null);

View File

@ -68,7 +68,7 @@ final public class StateMachineFactory
private StateMachineFactory private StateMachineFactory
(StateMachineFactory<OPERAND, STATE, EVENTTYPE, EVENT> that, (StateMachineFactory<OPERAND, STATE, EVENTTYPE, EVENT> that,
ApplicableTransition t) { ApplicableTransition<OPERAND, STATE, EVENTTYPE, EVENT> t) {
this.defaultInitialState = that.defaultInitialState; this.defaultInitialState = that.defaultInitialState;
this.transitionsListNode this.transitionsListNode
= new TransitionsListNode(t, that.transitionsListNode); = new TransitionsListNode(t, that.transitionsListNode);
@ -96,11 +96,12 @@ final public class StateMachineFactory
} }
private class TransitionsListNode { private class TransitionsListNode {
final ApplicableTransition transition; final ApplicableTransition<OPERAND, STATE, EVENTTYPE, EVENT> transition;
final TransitionsListNode next; final TransitionsListNode next;
TransitionsListNode TransitionsListNode
(ApplicableTransition transition, TransitionsListNode next) { (ApplicableTransition<OPERAND, STATE, EVENTTYPE, EVENT> transition,
TransitionsListNode next) {
this.transition = transition; this.transition = transition;
this.next = next; this.next = next;
} }
@ -225,8 +226,8 @@ final public class StateMachineFactory
addTransition(STATE preState, STATE postState, addTransition(STATE preState, STATE postState,
EVENTTYPE eventType, EVENTTYPE eventType,
SingleArcTransition<OPERAND, EVENT> hook){ SingleArcTransition<OPERAND, EVENT> hook){
return new StateMachineFactory return new StateMachineFactory<OPERAND, STATE, EVENTTYPE, EVENT>
(this, new ApplicableSingleOrMultipleTransition (this, new ApplicableSingleOrMultipleTransition<OPERAND, STATE, EVENTTYPE, EVENT>
(preState, eventType, new SingleInternalArc(postState, hook))); (preState, eventType, new SingleInternalArc(postState, hook)));
} }
@ -248,9 +249,9 @@ final public class StateMachineFactory
addTransition(STATE preState, Set<STATE> postStates, addTransition(STATE preState, Set<STATE> postStates,
EVENTTYPE eventType, EVENTTYPE eventType,
MultipleArcTransition<OPERAND, EVENT, STATE> hook){ MultipleArcTransition<OPERAND, EVENT, STATE> hook){
return new StateMachineFactory return new StateMachineFactory<OPERAND, STATE, EVENTTYPE, EVENT>
(this, (this,
new ApplicableSingleOrMultipleTransition new ApplicableSingleOrMultipleTransition<OPERAND, STATE, EVENTTYPE, EVENT>
(preState, eventType, new MultipleInternalArc(postStates, hook))); (preState, eventType, new MultipleInternalArc(postStates, hook)));
} }
@ -273,7 +274,7 @@ final public class StateMachineFactory
public StateMachineFactory public StateMachineFactory
<OPERAND, STATE, EVENTTYPE, EVENT> <OPERAND, STATE, EVENTTYPE, EVENT>
installTopology() { installTopology() {
return new StateMachineFactory(this, true); return new StateMachineFactory<OPERAND, STATE, EVENTTYPE, EVENT>(this, true);
} }
/** /**
@ -308,7 +309,8 @@ final public class StateMachineFactory
} }
private void makeStateMachineTable() { private void makeStateMachineTable() {
Stack<ApplicableTransition> stack = new Stack<ApplicableTransition>(); Stack<ApplicableTransition<OPERAND, STATE, EVENTTYPE, EVENT>> stack =
new Stack<ApplicableTransition<OPERAND, STATE, EVENTTYPE, EVENT>>();
Map<STATE, Map<EVENTTYPE, Transition<OPERAND, STATE, EVENTTYPE, EVENT>>> Map<STATE, Map<EVENTTYPE, Transition<OPERAND, STATE, EVENTTYPE, EVENT>>>
prototype = new HashMap<STATE, Map<EVENTTYPE, Transition<OPERAND, STATE, EVENTTYPE, EVENT>>>(); prototype = new HashMap<STATE, Map<EVENTTYPE, Transition<OPERAND, STATE, EVENTTYPE, EVENT>>>();
@ -469,7 +471,7 @@ final public class StateMachineFactory
} else if (transition instanceof StateMachineFactory.MultipleInternalArc) { } else if (transition instanceof StateMachineFactory.MultipleInternalArc) {
StateMachineFactory.MultipleInternalArc ma StateMachineFactory.MultipleInternalArc ma
= (StateMachineFactory.MultipleInternalArc) transition; = (StateMachineFactory.MultipleInternalArc) transition;
Iterator<STATE> iter = ma.validPostStates.iterator(); Iterator iter = ma.validPostStates.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Graph.Node fromNode = g.getNode(startState.toString()); Graph.Node fromNode = g.getNode(startState.toString());
Graph.Node toNode = g.getNode(iter.next().toString()); Graph.Node toNode = g.getNode(iter.next().toString());