Archivi tag: serialization

Kryo and FastUtil wrapper

While I was working with Apache Spark, I had a problem to write a FastUtil wrapper with Kryo Serializer. So I passed a day to working on it and I found a solution.
This is an example code that uses a Int2LongOpenHashMap wrapper that has public  long counter attribute.

WrappedInt2LongOpenHashMap p = new WrappedInt2LongOpenHashMap();
p.addTo(220, 20);
p.addTo(30, 5);
p.addTo(30, 15);
p.addTo(220, 5);
p.counter = 10;
p.inputName="prova";

System.out.println(p.counter);
System.out.println("---------");

The Java default serializer works fine, it serializes HashMap and the counter attribute. Continue reading Kryo and FastUtil wrapper