/** * Default constructor using the {@link org.objenesis.strategy.StdInstantiatorStrategy} */ public ObjenesisStd() { super(new StdInstantiatorStrategy()); }
/** * Instance using the {@link org.objenesis.strategy.StdInstantiatorStrategy} with or without * caching {@link org.objenesis.instantiator.ObjectInstantiator}s * * @param useCache If {@link org.objenesis.instantiator.ObjectInstantiator}s should be cached */ public ObjenesisStd(boolean useCache) { super(new StdInstantiatorStrategy(), useCache); } }
/** * Default constructor using the {@link org.objenesis.strategy.StdInstantiatorStrategy} */ public ObjenesisStd() { super(new StdInstantiatorStrategy()); }
/** * Instance using the {@link org.objenesis.strategy.StdInstantiatorStrategy} with or without * caching {@link org.objenesis.instantiator.ObjectInstantiator}s * * @param useCache If {@link org.objenesis.instantiator.ObjectInstantiator}s should be cached */ public ObjenesisStd(boolean useCache) { super(new StdInstantiatorStrategy(), useCache); } }
public KryoSerializer() { kryo = new Kryo(); kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); output = new Output(200, 2000000000); input = new Input(1); }
private Object getKryoDeserializedObject (final byte[] ser) { final Kryo kryo = new Kryo(); final Input input = new Input(new ByteArrayInputStream(ser)); kryo.setInstantiatorStrategy(new StdInstantiatorStrategy()); return kryo.readClassAndObject(input); }
private byte[] getKryoSerializedBytes (final Object obj) { final Kryo kryo = new Kryo(); final ByteArrayOutputStream os = new ByteArrayOutputStream(); final Output output = new Output(os); kryo.setInstantiatorStrategy(new StdInstantiatorStrategy()); kryo.writeClassAndObject(output, obj); output.flush(); return os.toByteArray(); }
public static Kryo getKryo() { if (_Kryo.get() == null) { Kryo kryo = new Kryo(); kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); kryo.register(BitSet.class, new BitSetSerializer()); _Kryo.set(kryo); } return _Kryo.get(); } }
@Override public Kryo getKryo(Map conf) { KryoSerializableDefault k = new KryoSerializableDefault(); k.setRegistrationRequired(Boolean.valueOf(conf.get(Config.TOPOLOGY_KRYO_REGISTER_REQUIRED).toString())); k.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); k.setReferences(false); return k; }
/** * Returns the Chill Kryo Serializer which is implicitly added to the classpath via flink-runtime. * Falls back to the default Kryo serializer if it can't be found. * @return The Kryo serializer instance. */ private Kryo getKryoInstance() { try { // check if ScalaKryoInstantiator is in class path (coming from Twitter's Chill library). // This will be true if Flink's Scala API is used. Class<?> chillInstantiatorClazz = Class.forName("org.apache.flink.runtime.types.FlinkScalaKryoInstantiator"); Object chillInstantiator = chillInstantiatorClazz.newInstance(); // obtain a Kryo instance through Twitter Chill Method m = chillInstantiatorClazz.getMethod("newKryo"); return (Kryo) m.invoke(chillInstantiator); } catch (ClassNotFoundException | InstantiationException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { LOG.warn("Falling back to default Kryo serializer because Chill serializer couldn't be found.", e); Kryo.DefaultInstantiatorStrategy initStrategy = new Kryo.DefaultInstantiatorStrategy(); initStrategy.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy()); Kryo kryo = new Kryo(); kryo.setInstantiatorStrategy(initStrategy); return kryo; } }
@Override protected Kryo initialValue() { Kryo kryo = new Kryo(); int count = 0; for (Class<?> klass : messages) { kryo.register(klass, REG_ID_BASE + count); count++; } kryo.register(BaseProtocol.JobResult.class, new JobResultSerializer(), count); kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); return kryo; } };
private void checkKryoInitialized() { if (this.kryo == null) { this.kryo = new Kryo(); Kryo.DefaultInstantiatorStrategy instantiatorStrategy = new Kryo.DefaultInstantiatorStrategy(); instantiatorStrategy.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy()); kryo.setInstantiatorStrategy(instantiatorStrategy); this.kryo.setAsmEnabled(true); KryoUtils.applyRegistrations(this.kryo, kryoRegistrations.values()); } }
@Override protected Kryo initialValue() { Kryo obj = new Kryo(); if (context != null && topoConf != null) { KryoTupleSerializer ser = new KryoTupleSerializer(topoConf, context); KryoTupleDeserializer deser = new KryoTupleDeserializer(topoConf, context); obj.register(TupleImpl.class, new TupleSerializer(ser, deser)); } if (!registrations.isEmpty()) { SerializationFactory.register(obj, registrations); } obj.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); return obj; } };
public Kryo create() { Kryo kryo = new Kryo(); kryo.setReferences(true); kryo.setRegistrationRequired(false); //Fix the NPE bug when deserializing Collections. ((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy()) .setFallbackInstantiatorStrategy(new StdInstantiatorStrategy()); return kryo; } };
private void checkKryoInitialized() { if (this.kryo == null) { this.kryo = new Kryo(); Kryo.DefaultInstantiatorStrategy instantiatorStrategy = new Kryo.DefaultInstantiatorStrategy(); instantiatorStrategy.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy()); kryo.setInstantiatorStrategy(instantiatorStrategy); this.kryo.setAsmEnabled(true); this.kryo.register(type); } }
@Override protected Kryo initialValue() { Kryo kryo = new Kryo(); kryo.setReferences(true); kryo.setRegistrationRequired(false); //Fix the NPE bug when deserializing Collections. ((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy()) .setFallbackInstantiatorStrategy(new StdInstantiatorStrategy()); return kryo; } };
private void checkKryoInitialized() { if (this.kryo == null) { this.kryo = new Kryo(); Kryo.DefaultInstantiatorStrategy instantiatorStrategy = new Kryo.DefaultInstantiatorStrategy(); instantiatorStrategy.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy()); kryo.setInstantiatorStrategy(instantiatorStrategy); this.kryo.setAsmEnabled(true); this.kryo.register(typeClass); } } // --------------------------------------------------------------------------------------------
@Override protected Kryo initialValue() { Kryo kryo = new Kryo(); kryo.setReferences(true); kryo.setRegistrationRequired(false); //Fix the NPE bug when deserializing Collections. ((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy()) .setFallbackInstantiatorStrategy(new StdInstantiatorStrategy()); return kryo; } };
private void checkKryoInitialized() { if (this.kryo == null) { this.kryo = new Kryo(); Kryo.DefaultInstantiatorStrategy instantiatorStrategy = new Kryo.DefaultInstantiatorStrategy(); instantiatorStrategy.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy()); kryo.setInstantiatorStrategy(instantiatorStrategy); this.kryo.setAsmEnabled(true); this.kryo.register(type); } }
@Override protected Kryo initialValue() throws Exception { Kryo kryo = new Kryo(); for (Class<?> type : useJavaSerializerTypes) { kryo.addDefaultSerializer(type, JavaSerializer.class); } kryo.setInstantiatorStrategy(new StdInstantiatorStrategy()); kryo.setRegistrationRequired(false); kryo.setReferences(false); return kryo; } };