當前位置: 首頁>>代碼示例>>Java>>正文


Java SparkConf.getBoolean方法代碼示例

本文整理匯總了Java中org.apache.spark.SparkConf.getBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java SparkConf.getBoolean方法的具體用法?Java SparkConf.getBoolean怎麽用?Java SparkConf.getBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.spark.SparkConf的用法示例。


在下文中一共展示了SparkConf.getBoolean方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: GryoSerializer

import org.apache.spark.SparkConf; //導入方法依賴的package包/類
public GryoSerializer(final SparkConf sparkConfiguration) {
    final long bufferSizeKb = sparkConfiguration.getSizeAsKb("spark.kryoserializer.buffer", "64k");
    final long maxBufferSizeMb = sparkConfiguration.getSizeAsMb("spark.kryoserializer.buffer.max", "64m");
    final boolean referenceTracking = sparkConfiguration.getBoolean("spark.kryo.referenceTracking", true);
    final boolean registrationRequired = sparkConfiguration.getBoolean("spark.kryo.registrationRequired", false);
    if (bufferSizeKb >= ByteUnit.GiB.toKiB(2L)) {
        throw new IllegalArgumentException("spark.kryoserializer.buffer must be less than 2048 mb, got: " + bufferSizeKb + " mb.");
    } else {
        this.bufferSize = (int) ByteUnit.KiB.toBytes(bufferSizeKb);
        if (maxBufferSizeMb >= ByteUnit.GiB.toMiB(2L)) {
            throw new IllegalArgumentException("spark.kryoserializer.buffer.max must be less than 2048 mb, got: " + maxBufferSizeMb + " mb.");
        } else {
            this.maxBufferSize = (int) ByteUnit.MiB.toBytes(maxBufferSizeMb);
            //this.userRegistrator = sparkConfiguration.getOption("spark.kryo.registrator");
        }
    }
    this.gryoPool = GryoPool.build().
            poolSize(sparkConfiguration.getInt(GryoPool.CONFIG_IO_GRYO_POOL_SIZE, GryoPool.CONFIG_IO_GRYO_POOL_SIZE_DEFAULT)).
            ioRegistries(makeApacheConfiguration(sparkConfiguration).getList(GryoPool.CONFIG_IO_REGISTRY, Collections.emptyList())).
            initializeMapper(builder -> {
                try {
                    builder.addCustom(Tuple2.class, new Tuple2Serializer())
                            .addCustom(Tuple2[].class)
                            .addCustom(Tuple3.class, new Tuple3Serializer())
                            .addCustom(Tuple3[].class)
                            .addCustom(CompactBuffer.class, new CompactBufferSerializer())
                            .addCustom(CompactBuffer[].class)
                            .addCustom(CompressedMapStatus.class)
                            .addCustom(BlockManagerId.class)
                            .addCustom(HighlyCompressedMapStatus.class, new ExternalizableSerializer())   // externalizable implemented so its okay
                            .addCustom(HttpBroadcast.class)
                            .addCustom(PythonBroadcast.class)
                            .addCustom(BoxedUnit.class)
                            .addCustom(Class.forName("scala.reflect.ClassTag$$anon$1"), new JavaSerializer())
                            .addCustom(Class.forName("scala.reflect.ManifestFactory$$anon$1"), new JavaSerializer())
                            .addCustom(WrappedArray.ofRef.class, new WrappedArraySerializer())
                            .addCustom(MessagePayload.class)
                            .addCustom(ViewIncomingPayload.class)
                            .addCustom(ViewOutgoingPayload.class)
                            .addCustom(ViewPayload.class)
                            .addCustom(SerializableConfiguration.class, new JavaSerializer())
                            .addCustom(VertexWritable.class, new VertexWritableSerializer())
                            .addCustom(ObjectWritable.class, new ObjectWritableSerializer())
                            .referenceTracking(referenceTracking)
                            .registrationRequired(registrationRequired);
                    // add these as we find ClassNotFoundExceptions
                } catch (final ClassNotFoundException e) {
                    throw new IllegalStateException(e);
                }
            }).create();
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:52,代碼來源:GryoSerializer.java


注:本文中的org.apache.spark.SparkConf.getBoolean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。