Open ferng opened 5 years ago
this involves a new RingBuffer constructor
public RingBuffer(final int id, final int size, boolean update) { if (update) { this.update = update; prepop buffer with blank messages } }
new set method in RingBuffer
set(pos, Object payload) { buffer[getRealPos(pos)].setPayload("onions") }
or a check on whether update is true in which case update payload, if not check it is of Message type and then write the message
Message also needs a new method to setPayload as it's no longer final
modify buffer to act as a container of messages so only data is overwritten. this reuse avoids the creation / deletion of objects.