Esempio n. 1
0
 public override object GetProxy(Type protocol, IPEndPoint addr, Configuration conf
                                 )
 {
     Log.Debug("Creating a HadoopYarnProtoRpc proxy for protocol " + protocol);
     return(RpcFactoryProvider.GetClientFactory(conf).GetClient(protocol, 1, addr, conf
                                                                ));
 }
Esempio n. 2
0
 public override Server GetServer <_T0>(Type protocol, object instance, IPEndPoint
                                        addr, Configuration conf, SecretManager <_T0> secretManager, int numHandlers, string
                                        portRangeConfig)
 {
     Log.Debug("Creating a HadoopYarnProtoRpc server for protocol " + protocol + " with "
               + numHandlers + " handlers");
     return(RpcFactoryProvider.GetServerFactory(conf).GetServer(protocol, instance, addr
                                                                , conf, secretManager, numHandlers, portRangeConfig));
 }
Esempio n. 3
0
        public virtual void TestFactoryProvider()
        {
            Configuration    conf          = new Configuration();
            RpcClientFactory clientFactory = null;
            RpcServerFactory serverFactory = null;

            clientFactory = RpcFactoryProvider.GetClientFactory(conf);
            serverFactory = RpcFactoryProvider.GetServerFactory(conf);
            NUnit.Framework.Assert.AreEqual(typeof(RpcClientFactoryPBImpl), clientFactory.GetType
                                                ());
            NUnit.Framework.Assert.AreEqual(typeof(RpcServerFactoryPBImpl), serverFactory.GetType
                                                ());
            conf.Set(YarnConfiguration.IpcClientFactoryClass, "unknown");
            conf.Set(YarnConfiguration.IpcServerFactoryClass, "unknown");
            conf.Set(YarnConfiguration.IpcRecordFactoryClass, "unknown");
            try
            {
                clientFactory = RpcFactoryProvider.GetClientFactory(conf);
                NUnit.Framework.Assert.Fail("Expected an exception - unknown serializer");
            }
            catch (YarnRuntimeException)
            {
            }
            try
            {
                serverFactory = RpcFactoryProvider.GetServerFactory(conf);
                NUnit.Framework.Assert.Fail("Expected an exception - unknown serializer");
            }
            catch (YarnRuntimeException)
            {
            }
            conf = new Configuration();
            conf.Set(YarnConfiguration.IpcClientFactoryClass, "NonExistantClass");
            conf.Set(YarnConfiguration.IpcServerFactoryClass, typeof(RpcServerFactoryPBImpl).
                     FullName);
            try
            {
                clientFactory = RpcFactoryProvider.GetClientFactory(conf);
                NUnit.Framework.Assert.Fail("Expected an exception - unknown class");
            }
            catch (YarnRuntimeException)
            {
            }
            try
            {
                serverFactory = RpcFactoryProvider.GetServerFactory(conf);
            }
            catch (YarnRuntimeException)
            {
                NUnit.Framework.Assert.Fail("Error while loading factory using reflection: [" + typeof(
                                                RpcServerFactoryPBImpl).FullName + "]");
            }
        }
Esempio n. 4
0
 public override void StopProxy(object proxy, Configuration conf)
 {
     RpcFactoryProvider.GetClientFactory(conf).StopClient(proxy);
 }