ByteBufUtil.getBytes() performs a deep copy of the contents of the
buffer. This is completely superfluous, as we can use the underlying
nioBuffer() directly.
JIRA: CONTROLLER-2115
Change-Id: I0a9f0ec7b22682cd41063db93921c159ba66b082
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import com.google.common.annotations.VisibleForTesting;
import io.atomix.utils.serializer.KryoJournalSerdesBuilder;
import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import java.io.IOException;
import java.io.InputStream;
@Override
public T bytesToObject(final ByteBuf buf) {
- // FIXME: ByteBufUtil creates a copy -- we do not want to do that!
- return deserialize(ByteBufUtil.getBytes(buf));
+ return deserialize(buf.nioBuffer());
}
};
}