Package org.apache.cassandra.cache
Class RefCountedMemory
- java.lang.Object
-
- org.apache.cassandra.io.util.Memory
-
- org.apache.cassandra.cache.RefCountedMemory
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,ReadableMemory
public class RefCountedMemory extends Memory implements java.lang.AutoCloseable
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.io.util.Memory
NO_BYTE_BUFFERS, peer, size
-
-
Constructor Summary
Constructors Constructor Description RefCountedMemory(long size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
RefCountedMemory
copy(long newSize)
void
free()
boolean
reference()
void
unreference()
decrement reference count.
-
-
-
Method Detail
-
reference
public boolean reference()
- Returns:
- true if we succeed in referencing before the reference count reaches zero. (A FreeableMemory object is created with a reference count of one.)
-
unreference
public void unreference()
decrement reference count. if count reaches zero, the object is freed.
-
copy
public RefCountedMemory copy(long newSize)
-
-