Package org.apache.cassandra.io.util
Class SafeMemory
- java.lang.Object
-
- org.apache.cassandra.io.util.Memory
-
- org.apache.cassandra.io.util.SafeMemory
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,ReadableMemory
,SharedCloseable
public class SafeMemory extends Memory implements SharedCloseable
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.io.util.Memory
NO_BYTE_BUFFERS, peer, size
-
-
Constructor Summary
Constructors Constructor Description SafeMemory(long size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTo(Ref.IdentityCollection identities)
protected void
checkBounds(long start, long end)
void
close()
java.lang.Throwable
close(java.lang.Throwable accumulate)
SafeMemory
copy(long newSize)
void
free()
SafeMemory
sharedCopy()
-
-
-
Method Detail
-
sharedCopy
public SafeMemory sharedCopy()
- Specified by:
sharedCopy
in interfaceSharedCloseable
- Returns:
- a new instance of the object representing the same state and backed by the same underlying resources. Coordinates with the original (and other instances) when the underlying resource should be closed. Throws an exception if the shared resource has already been closed.
-
close
public void close()
-
close
public java.lang.Throwable close(java.lang.Throwable accumulate)
- Specified by:
close
in interfaceSharedCloseable
-
copy
public SafeMemory copy(long newSize)
-
checkBounds
@Inline protected void checkBounds(long start, long end)
- Overrides:
checkBounds
in classMemory
-
addTo
public void addTo(Ref.IdentityCollection identities)
- Specified by:
addTo
in interfaceSharedCloseable
-
-