use of com.esotericsoftware.kryo.Kryo in project flink by apache.
the class WritableComparator method checkKryoInitialized.
// --------------------------------------------------------------------------------------------
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);
}
}
use of com.esotericsoftware.kryo.Kryo in project flink by apache.
the class WritableSerializer method checkKryoInitialized.
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);
}
}
use of com.esotericsoftware.kryo.Kryo in project storm by apache.
the class BlowfishTupleSerializerTest method testEncryptsAndDecryptsMessage.
/**
* Reads a string encrypted by another instance with a shared key
*/
@Test
public void testEncryptsAndDecryptsMessage() {
String testText = "Tetraodontidae is a family of primarily marine and estuarine fish of the order" + " Tetraodontiformes. The family includes many familiar species, which are" + " variously called pufferfish, puffers, balloonfish, blowfish, bubblefish," + " globefish, swellfish, toadfish, toadies, honey toads, sugar toads, and sea" + " squab.[1] They are morphologically similar to the closely related" + " porcupinefish, which have large external spines (unlike the thinner, hidden" + " spines of Tetraodontidae, which are only visible when the fish has puffed up)." + " The scientific name refers to the four large teeth, fused into an upper and" + " lower plate, which are used for crushing the shells of crustaceans and" + " mollusks, their natural prey.";
Kryo kryo = new Kryo();
String arbitraryKey = "7dd6fb3203878381b08f9c89d25ed105";
Map stormConf = ImmutableMap.of(BlowfishTupleSerializer.SECRET_KEY, arbitraryKey);
BlowfishTupleSerializer writerBTS = new BlowfishTupleSerializer(kryo, stormConf);
BlowfishTupleSerializer readerBTS = new BlowfishTupleSerializer(kryo, stormConf);
int bufferSize = 1024;
Output output = new Output(bufferSize, bufferSize);
Input input = new Input(bufferSize);
String[] stringList = testText.split(" ");
ListDelegate delegate = new ListDelegate();
delegate.addAll(Arrays.asList(stringList));
writerBTS.write(kryo, output, delegate);
input.setBuffer(output.getBuffer());
ListDelegate outDelegate = readerBTS.read(kryo, input, ListDelegate.class);
Assert.assertEquals(testText, Joiner.on(" ").join(outDelegate.toArray()));
}
use of com.esotericsoftware.kryo.Kryo in project flink by apache.
the class AvroSerializer method checkKryoInitialized.
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
Kryo.DefaultInstantiatorStrategy instantiatorStrategy = new Kryo.DefaultInstantiatorStrategy();
instantiatorStrategy.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy());
kryo.setInstantiatorStrategy(instantiatorStrategy);
// register Avro types.
this.kryo.register(GenericData.Array.class, new Serializers.SpecificInstanceCollectionSerializerForArrayList());
this.kryo.register(Utf8.class);
this.kryo.register(GenericData.EnumSymbol.class);
this.kryo.register(GenericData.Fixed.class);
this.kryo.register(GenericData.StringType.class);
this.kryo.setAsmEnabled(true);
this.kryo.register(type);
}
}
use of com.esotericsoftware.kryo.Kryo in project flink by apache.
the class ValueComparator method checkKryoInitialized.
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);
}
}
Aggregations