@Override public Kryo create() { return new Kryo(); } }, true);
public KryoCodec() { super(new Kryo(), true); }
public Kryo create() { final Kryo kryo = new Kryo(); //TODO: configure kryo instance, customize settings //TODO: e.g. looking for Kryo via ContextResolver (like Jackson) return kryo; } };
/** {@inheritDoc} */ @Override protected Kryo initialValue() { return new Kryo(); } };
/** * Constructs a {@link DefaultStateSerializer} instance with the given list * of classes registered in kryo. * * @param classesToRegister the classes to register. */ public DefaultStateSerializer(List<Class<?>> classesToRegister) { kryo = new Kryo(); output = new Output(2000, 2000000000); for (Class<?> klazz : classesToRegister) { kryo.register(klazz); } }
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 KryoSerializer() { kryo = new Kryo(); kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); output = new Output(200, 2000000000); input = new Input(1); }
/** * Sub classes can customize the Kryo instance by overriding this method * * @return create Kryo instance */ protected Kryo createInstance() { Kryo kryo = new Kryo(); if (classLoader != null) { kryo.setClassLoader(classLoader); } kryo.setReferences(false); for (Class<?> clazz : classes) { kryo.register(clazz); } return kryo; }
/** * Sub classes can customize the Kryo instance by overriding this method * * @return create Kryo instance */ protected Kryo createInstance() { Kryo kryo = new Kryo(); if (classLoader != null) { kryo.setClassLoader(classLoader); } kryo.setReferences(false); for (Class<?> clazz : classes) { kryo.register(clazz); } 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 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); } }
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); } }
public static String toKryo(SearchArgument sarg) { Output out = new Output(4 * 1024, 10 * 1024 * 1024); new Kryo().writeObject(out, sarg); out.close(); return Base64.encodeBase64String(out.toBytes()); }
@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; } };
@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; } };