At this moment, the encoder is called from a single thread per producer instance.
Thanks, Jun On Thu, Oct 23, 2014 at 8:20 PM, Rajiv Kurian <ra...@signalfuse.com> wrote: > Are encoders only ever called from a single thread? > > I have a stateful utility class that I use to encode my objects. Is it safe > to only create a single instance? Something like this: > > MyObjectEncoder > > public class MyObjectEncoder implements Encoder<MyObject> { > > private final MyObjectEncoderHelper helper = > new MyObjectEncoderHelper(); > > public MyObjectEncoder(VerifiableProperties props) {} > > @Override > > public byte[] toBytes(MyObject myObject) { > > // Stateful. So can't be called concurrently. > > helper.encode(myObject); > > return helper.bytes(); > > } > > } > > I am wondering if this is legal or if I have to create a new helper object > every time toBytes is called. > > > Thanks! >