Package org.apache.cassandra.net
Class ShareableBytes
java.lang.Object
org.apache.cassandra.net.ShareableBytes
A wrapper for possibly sharing portions of a single,
BufferPools.forNetworking() managed, ByteBuffer;
optimised for the case where no sharing is necessary.
When sharing is necessary, share() method must be invoked by the owning thread
before a ShareableBytes instance can be shared with another thread.-
Method Summary
Modifier and TypeMethodDescriptionget()booleanvoidrelease()intshare()Ensure this ShareableBytes will use atomic operations for updating its count from now on.sliceAndConsume(int length) Create a slice over the nextlengthbytes, consuming them from our buffer, and incrementing the owner countstatic ShareableByteswrap(ByteBuffer buffer)
-
Method Details
-
get
-
hasRemaining
public boolean hasRemaining() -
remaining
public int remaining() -
release
public void release() -
sliceAndConsume
Create a slice over the nextlengthbytes, consuming them from our buffer, and incrementing the owner count -
wrap
-