创建序列化器,序列化管理器,closureSerializer
Posted chengbao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了创建序列化器,序列化管理器,closureSerializer相关的知识,希望对你有一定的参考价值。
创建序列化器,序列化管理器,closureSerializer
//通过反射创建序列化对象 // Create an instance of the class with the given name, possibly initializing it with our conf def instantiateClass[T](className: String): T = { val cls = Utils.classForName(className) // Look for a constructor taking a SparkConf and a boolean isDriver, then one taking just // SparkConf, then one taking no arguments try { cls.getConstructor(classOf[SparkConf], java.lang.Boolean.TYPE) .newInstance(conf, new java.lang.Boolean(isDriver)) .asInstanceOf[T] } catch { case _: NoSuchMethodException => try { cls.getConstructor(classOf[SparkConf]).newInstance(conf).asInstanceOf[T] } catch { case _: NoSuchMethodException => cls.getConstructor().newInstance().asInstanceOf[T] } } } // Create an instance of the class named by the given SparkConf property, or defaultClassName // if the property is not set, possibly initializing it with our conf def instantiateClassFromConf[T](propertyName: String, defaultClassName: String): T = { instantiateClass[T](conf.get(propertyName, defaultClassName)) } val serializer = instantiateClassFromConf[Serializer]( "spark.serializer", "org.apache.spark.serializer.JavaSerializer") logDebug(s"Using serializer: ${serializer.getClass}") val serializerManager = new SerializerManager(serializer, conf, ioEncryptionKey) val closureSerializer = new JavaSerializer(conf)
closureSerializer
以上是关于创建序列化器,序列化管理器,closureSerializer的主要内容,如果未能解决你的问题,请参考以下文章
Django 序列化器与 rest_framework 序列化器
Jackson:没有找到类的序列化器~~~~~也没有找到创建 BeanSerializer 的属性
Microsoft Access ODBC 驱动程序管理器函数序列错误