directmemory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Lamy <ol...@apache.org>
Subject Re: KryoSerializer
Date Tue, 30 Oct 2012 15:43:41 GMT
2012/10/29 Christoph Engelbert <noctarius@apache.org>:
> 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

Mime
View raw message