From 1fac1ac98cf83e90d70004a27454bc2a64157c8c Mon Sep 17 00:00:00 2001 From: Vinod Kumar Vavilapalli Date: Wed, 22 May 2013 22:51:04 +0000 Subject: [PATCH] YARN-708. Moved RecordFactory classes to hadoop-yarn-api, and put some miscellaneous fixes to the interfaces. Contributed by Siddharth Seth. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1485478 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 ++ .../org/apache/hadoop/yarn/YarnException.java | 0 .../hadoop/yarn/conf/YarnConfiguration.java | 27 +++++++------- .../hadoop/yarn/factories/RecordFactory.java | 3 +- .../providers/RecordFactoryProvider.java | 16 +++------ .../org/apache/hadoop/yarn/util/Records.java | 0 .../yarn/factories/RpcClientFactory.java | 3 +- .../yarn/factories/RpcServerFactory.java | 4 +-- .../impl/pb/RecordFactoryPBImpl.java | 2 +- .../impl/pb/RpcClientFactoryPBImpl.java | 3 +- .../impl/pb/RpcServerFactoryPBImpl.java | 6 ++-- .../factory/providers/RpcFactoryProvider.java | 35 +++++-------------- .../hadoop/yarn/TestRpcFactoryProvider.java | 11 +++--- .../impl/pb/TestPBLocalizerRPC.java | 9 +++-- .../impl/pb/TestPBRecordImpl.java | 2 -- 15 files changed, 47 insertions(+), 77 deletions(-) rename hadoop-yarn-project/hadoop-yarn/{hadoop-yarn-common => hadoop-yarn-api}/src/main/java/org/apache/hadoop/yarn/YarnException.java (100%) rename hadoop-yarn-project/hadoop-yarn/{hadoop-yarn-common => hadoop-yarn-api}/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java (98%) rename hadoop-yarn-project/hadoop-yarn/{hadoop-yarn-common => hadoop-yarn-api}/src/main/java/org/apache/hadoop/yarn/factories/RecordFactory.java (88%) rename hadoop-yarn-project/hadoop-yarn/{hadoop-yarn-common => hadoop-yarn-api}/src/main/java/org/apache/hadoop/yarn/factory/providers/RecordFactoryProvider.java (74%) rename hadoop-yarn-project/hadoop-yarn/{hadoop-yarn-common => hadoop-yarn-api}/src/main/java/org/apache/hadoop/yarn/util/Records.java (100%) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 1d2fe9da6ab..f5923a78f31 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -260,6 +260,9 @@ Release 2.0.5-beta - UNRELEASED also in unsecure mode to prevent AMs from faking resource requirements in unsecure mode. (Omkar Vinit Joshi via vinodkv) + YARN-708. Moved RecordFactory classes to hadoop-yarn-api, and put some + miscellaneous fixes to the interfaces. (Siddharth Seth via vinodkv) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/YarnException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/YarnException.java similarity index 100% rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/YarnException.java rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/YarnException.java diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java similarity index 98% rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java index f9b017de421..1d5a9d67cf2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java @@ -56,26 +56,23 @@ public class YarnConfiguration extends Configuration { public static final String IPC_PREFIX = YARN_PREFIX + "ipc."; /** Factory to create client IPC classes.*/ - public static final String IPC_CLIENT_FACTORY = + public static final String IPC_CLIENT_FACTORY_CLASS = IPC_PREFIX + "client.factory.class"; - - /** Type of serialization to use.*/ - public static final String IPC_SERIALIZER_TYPE = - IPC_PREFIX + "serializer.type"; - public static final String DEFAULT_IPC_SERIALIZER_TYPE = "protocolbuffers"; - + public static final String DEFAULT_IPC_CLIENT_FACTORY_CLASS = + "org.apache.hadoop.yarn.factories.impl.pb.RpcClientFactoryPBImpl"; + /** Factory to create server IPC classes.*/ - public static final String IPC_SERVER_FACTORY = + public static final String IPC_SERVER_FACTORY_CLASS = IPC_PREFIX + "server.factory.class"; - - /** Factory to create IPC exceptions.*/ - public static final String IPC_EXCEPTION_FACTORY = - IPC_PREFIX + "exception.factory.class"; - + public static final String DEFAULT_IPC_SERVER_FACTORY_CLASS = + "org.apache.hadoop.yarn.factories.impl.pb.RpcServerFactoryPBImpl"; + /** Factory to create serializeable records.*/ - public static final String IPC_RECORD_FACTORY = + public static final String IPC_RECORD_FACTORY_CLASS = IPC_PREFIX + "record.factory.class"; - + public static final String DEFAULT_IPC_RECORD_FACTORY_CLASS = + "org.apache.hadoop.yarn.factories.impl.pb.RecordFactoryPBImpl"; + /** RPC class implementation*/ public static final String IPC_RPC_IMPL = IPC_PREFIX + "rpc.class"; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/RecordFactory.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/factories/RecordFactory.java similarity index 88% rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/RecordFactory.java rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/factories/RecordFactory.java index e62d5a6594e..219502d36ff 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/RecordFactory.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/factories/RecordFactory.java @@ -18,9 +18,8 @@ package org.apache.hadoop.yarn.factories; -import org.apache.hadoop.yarn.YarnException; public interface RecordFactory { - public T newRecordInstance(Class clazz) throws YarnException; + public T newRecordInstance(Class clazz); } 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-api/src/main/java/org/apache/hadoop/yarn/factory/providers/RecordFactoryProvider.java similarity index 74% rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RecordFactoryProvider.java rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/factory/providers/RecordFactoryProvider.java index 66ed1592208..f016675e1b0 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-api/src/main/java/org/apache/hadoop/yarn/factory/providers/RecordFactoryProvider.java @@ -25,7 +25,6 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.YarnException; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.factories.RecordFactory; -import org.apache.hadoop.yarn.factories.impl.pb.RecordFactoryPBImpl; public class RecordFactoryProvider { private static Configuration defaultConf; @@ -43,17 +42,10 @@ public class RecordFactoryProvider { //Users can specify a particular factory by providing a configuration. conf = defaultConf; } - String recordFactoryClassName = conf.get(YarnConfiguration.IPC_RECORD_FACTORY); - if (recordFactoryClassName == null) { - String serializer = conf.get(YarnConfiguration.IPC_SERIALIZER_TYPE, YarnConfiguration.DEFAULT_IPC_SERIALIZER_TYPE); - if (serializer.equals(YarnConfiguration.DEFAULT_IPC_SERIALIZER_TYPE)) { - return RecordFactoryPBImpl.get(); - } else { - throw new YarnException("Unknown serializer: [" + conf.get(YarnConfiguration.IPC_SERIALIZER_TYPE) + "]. Use keys: [" + YarnConfiguration.IPC_RECORD_FACTORY + "] to specify Record factory"); - } - } else { - return (RecordFactory) getFactoryClassInstance(recordFactoryClassName); - } + String recordFactoryClassName = conf.get( + YarnConfiguration.IPC_RECORD_FACTORY_CLASS, + YarnConfiguration.DEFAULT_IPC_RECORD_FACTORY_CLASS); + return (RecordFactory) getFactoryClassInstance(recordFactoryClassName); } private static Object getFactoryClassInstance(String factoryClassName) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/Records.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/Records.java similarity index 100% rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/Records.java rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/Records.java diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/RpcClientFactory.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/RpcClientFactory.java index 191091f9688..511c830fb86 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/RpcClientFactory.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/RpcClientFactory.java @@ -21,12 +21,11 @@ package org.apache.hadoop.yarn.factories; import java.net.InetSocketAddress; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.yarn.YarnException; public interface RpcClientFactory { public Object getClient(Class protocol, long clientVersion, - InetSocketAddress addr, Configuration conf) throws YarnException; + InetSocketAddress addr, Configuration conf); public void stopClient(Object proxy); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/RpcServerFactory.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/RpcServerFactory.java index 94d7476e9df..27b2d326db9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/RpcServerFactory.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/RpcServerFactory.java @@ -24,13 +24,11 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.ipc.Server; import org.apache.hadoop.security.token.SecretManager; import org.apache.hadoop.security.token.TokenIdentifier; -import org.apache.hadoop.yarn.YarnException; public interface RpcServerFactory { public Server getServer(Class protocol, Object instance, InetSocketAddress addr, Configuration conf, SecretManager secretManager, - int numHandlers, String portRangeConfig) - throws YarnException; + int numHandlers, String portRangeConfig); } \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RecordFactoryPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RecordFactoryPBImpl.java index 5cfec03d53d..ce8d05c117e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RecordFactoryPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RecordFactoryPBImpl.java @@ -45,7 +45,7 @@ public class RecordFactoryPBImpl implements RecordFactory { @SuppressWarnings("unchecked") @Override - public T newRecordInstance(Class clazz) throws YarnException { + public T newRecordInstance(Class clazz) { Constructor constructor = cache.get(clazz); if (constructor == null) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RpcClientFactoryPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RpcClientFactoryPBImpl.java index 1cb5fa0acdf..9fc81d2c083 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RpcClientFactoryPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RpcClientFactoryPBImpl.java @@ -50,7 +50,8 @@ public class RpcClientFactoryPBImpl implements RpcClientFactory { private RpcClientFactoryPBImpl() { } - public Object getClient(Class protocol, long clientVersion, InetSocketAddress addr, Configuration conf) throws YarnException { + public Object getClient(Class protocol, long clientVersion, + InetSocketAddress addr, Configuration conf) { Constructor constructor = cache.get(protocol); if (constructor == null) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RpcServerFactoryPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RpcServerFactoryPBImpl.java index 21daf01959b..49c7bc7d003 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RpcServerFactoryPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factories/impl/pb/RpcServerFactoryPBImpl.java @@ -63,8 +63,7 @@ public class RpcServerFactoryPBImpl implements RpcServerFactory { public Server getServer(Class protocol, Object instance, InetSocketAddress addr, Configuration conf, - SecretManager secretManager, int numHandlers) - throws YarnException { + SecretManager secretManager, int numHandlers) { return getServer(protocol, instance, addr, conf, secretManager, numHandlers, null); } @@ -73,8 +72,7 @@ public class RpcServerFactoryPBImpl implements RpcServerFactory { public Server getServer(Class protocol, Object instance, InetSocketAddress addr, Configuration conf, SecretManager secretManager, int numHandlers, - String portRangeConfig) - throws YarnException { + String portRangeConfig) { Constructor constructor = serviceCache.get(protocol); if (constructor == 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 1c6e1427ad0..38deca667d8 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 @@ -21,21 +21,16 @@ package org.apache.hadoop.yarn.factory.providers; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.YarnException; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.factories.RpcClientFactory; import org.apache.hadoop.yarn.factories.RpcServerFactory; -import org.apache.hadoop.yarn.factories.impl.pb.RpcClientFactoryPBImpl; -import org.apache.hadoop.yarn.factories.impl.pb.RpcServerFactoryPBImpl; /** * A public static get() method must be present in the Client/Server Factory implementation. */ public class RpcFactoryProvider { - private static final Log LOG = LogFactory.getLog(RpcFactoryProvider.class); private RpcFactoryProvider() { @@ -46,29 +41,17 @@ public class RpcFactoryProvider { if (conf == null) { conf = new Configuration(); } - String serverFactoryClassName = conf.get(YarnConfiguration.IPC_SERVER_FACTORY); - if (serverFactoryClassName == null) { - if (conf.get(YarnConfiguration.IPC_SERIALIZER_TYPE, YarnConfiguration.DEFAULT_IPC_SERIALIZER_TYPE).equals(YarnConfiguration.DEFAULT_IPC_SERIALIZER_TYPE)) { - return RpcServerFactoryPBImpl.get(); - } else { - throw new YarnException("Unknown serializer: [" + conf.get(YarnConfiguration.IPC_SERIALIZER_TYPE) + "]. Use keys: [" + YarnConfiguration.IPC_CLIENT_FACTORY + "][" + YarnConfiguration.IPC_SERVER_FACTORY + "] to specify factories"); - } - } else { - return (RpcServerFactory) getFactoryClassInstance(serverFactoryClassName); - } + String serverFactoryClassName = conf.get( + YarnConfiguration.IPC_SERVER_FACTORY_CLASS, + YarnConfiguration.DEFAULT_IPC_SERVER_FACTORY_CLASS); + return (RpcServerFactory) getFactoryClassInstance(serverFactoryClassName); } - + public static RpcClientFactory getClientFactory(Configuration conf) { - String clientFactoryClassName = conf.get(YarnConfiguration.IPC_CLIENT_FACTORY); - if (clientFactoryClassName == null) { - if (conf.get(YarnConfiguration.IPC_SERIALIZER_TYPE, YarnConfiguration.DEFAULT_IPC_SERIALIZER_TYPE).equals(YarnConfiguration.DEFAULT_IPC_SERIALIZER_TYPE)) { - return RpcClientFactoryPBImpl.get(); - } else { - throw new YarnException("Unknown serializer: [" + conf.get(YarnConfiguration.IPC_SERIALIZER_TYPE) + "]. Use keys: [" + YarnConfiguration.IPC_CLIENT_FACTORY + "][" + YarnConfiguration.IPC_SERVER_FACTORY + "] to specify factories"); - } - } else { - return(RpcClientFactory) getFactoryClassInstance(clientFactoryClassName); - } + String clientFactoryClassName = conf.get( + YarnConfiguration.IPC_CLIENT_FACTORY_CLASS, + YarnConfiguration.DEFAULT_IPC_CLIENT_FACTORY_CLASS); + return (RpcClientFactory) getFactoryClassInstance(clientFactoryClassName); } private static Object getFactoryClassInstance(String factoryClassName) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRpcFactoryProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRpcFactoryProvider.java index 84e1968acb8..db5caa93194 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRpcFactoryProvider.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRpcFactoryProvider.java @@ -42,8 +42,11 @@ public class TestRpcFactoryProvider { serverFactory = RpcFactoryProvider.getServerFactory(conf); Assert.assertEquals(RpcClientFactoryPBImpl.class, clientFactory.getClass()); Assert.assertEquals(RpcServerFactoryPBImpl.class, serverFactory.getClass()); - - conf.set(YarnConfiguration.IPC_SERIALIZER_TYPE, "writable"); + + conf.set(YarnConfiguration.IPC_CLIENT_FACTORY_CLASS, "unknown"); + conf.set(YarnConfiguration.IPC_SERVER_FACTORY_CLASS, "unknown"); + conf.set(YarnConfiguration.IPC_RECORD_FACTORY_CLASS, "unknown"); + try { clientFactory = RpcFactoryProvider.getClientFactory(conf); Assert.fail("Expected an exception - unknown serializer"); @@ -56,8 +59,8 @@ public class TestRpcFactoryProvider { } conf = new Configuration(); - conf.set(YarnConfiguration.IPC_CLIENT_FACTORY, "NonExistantClass"); - conf.set(YarnConfiguration.IPC_SERVER_FACTORY, RpcServerFactoryPBImpl.class.getName()); + conf.set(YarnConfiguration.IPC_CLIENT_FACTORY_CLASS, "NonExistantClass"); + conf.set(YarnConfiguration.IPC_SERVER_FACTORY_CLASS, RpcServerFactoryPBImpl.class.getName()); try { clientFactory = RpcFactoryProvider.getClientFactory(conf); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBLocalizerRPC.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBLocalizerRPC.java index 56fbeeab18e..221b9df74df 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBLocalizerRPC.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBLocalizerRPC.java @@ -18,11 +18,13 @@ package org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.impl.pb; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.net.InetSocketAddress; -import org.apache.hadoop.ipc.Server; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.yarn.conf.YarnConfiguration; +import org.apache.hadoop.ipc.Server; import org.apache.hadoop.yarn.factories.RecordFactory; import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; import org.apache.hadoop.yarn.ipc.YarnRPC; @@ -30,9 +32,7 @@ import org.apache.hadoop.yarn.server.nodemanager.api.LocalizationProtocol; import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerAction; import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerHeartbeatResponse; import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.LocalizerStatus; - import org.junit.Test; -import static org.junit.Assert.*; public class TestPBLocalizerRPC { @@ -40,7 +40,6 @@ public class TestPBLocalizerRPC { static RecordFactory createPBRecordFactory() { Configuration conf = new Configuration(); - conf.set(YarnConfiguration.IPC_SERIALIZER_TYPE, "protocolbuffers"); return RecordFactoryProvider.getRecordFactory(conf); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBRecordImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBRecordImpl.java index be6d7e2e38e..ff9078c909b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBRecordImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBRecordImpl.java @@ -31,7 +31,6 @@ import org.apache.hadoop.io.DataOutputBuffer; import org.apache.hadoop.yarn.api.records.LocalResource; import org.apache.hadoop.yarn.api.records.LocalResourceVisibility; import org.apache.hadoop.yarn.api.records.impl.pb.LocalResourcePBImpl; -import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.factories.RecordFactory; import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; import org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalResourceStatusProto; @@ -53,7 +52,6 @@ public class TestPBRecordImpl { static RecordFactory createPBRecordFactory() { Configuration conf = new Configuration(); - conf.set(YarnConfiguration.IPC_SERIALIZER_TYPE, "protocolbuffers"); return RecordFactoryProvider.getRecordFactory(conf); }