You may want to see how serializer/deserializer in https://github.com/eishay/jvm-serializers
is done -- Martin wrote it (or at least modified & has maintained it), so it should be along best practices. -+ Tatu +- On Tue, Oct 30, 2012 at 9:33 AM, Simone Tripodi <[email protected]> wrote: >> Take care of the field private final Kryo kryo; too. >> Is this class declared as thread safe ? > > IIRC, yes, a Kryo instance should be thread safe, but much better is > we double check - I just sent Martin a tweet message :P > > best, > -Simo > > http://people.apache.org/~simonetripodi/ > http://simonetripodi.livejournal.com/ > http://twitter.com/simonetripodi > http://www.99soft.org/ > > > On Tue, Oct 30, 2012 at 4:43 PM, Olivier Lamy <[email protected]> wrote: >> 2012/10/29 Christoph Engelbert <[email protected]>: >>> Hey guys, >>> >>> while having a look how to implement the Lightning Serializer >>> adapter I recognized that maybe the current implementation of the >>> KryoSerializer and maybe some more could be absolutely thread unsafe. >>> >>> private final byte[] buffer = new byte[ BUFFER_SIZE ]; >>> private final Output output = new Output( buffer, -1 ); >>> private final Input input = new Input( buffer ); >>> >>> Only one byte[] buffer is used for serialization and >>> deserialization. Is somewhere deep in DM an instantiater hidden that >>> generates new instances of the serializer or will there be a problem >>> if different threads read / write at the same time? >> Yup you must write a KryoSerializer which is thread safe (others >> de/serializer are thread safe). >> >> Take care of the field private final Kryo kryo; too. >> Is this class declared as thread safe ? >> >> >>> >>> Cheers Chris >> >> >> >> -- >> Olivier Lamy >> Talend: http://coders.talend.com >> http://twitter.com/olamy | http://linkedin.com/in/olamy
