public class SingleMappedFile extends MappedFile
DEFAULT_SYNC_MODE, newChunkListener, RETAIN
Constructor and Description |
---|
SingleMappedFile(@NotNull File file,
@NotNull RandomAccessFile raf,
long capacity,
boolean readOnly)
Constructs a new SingleMappedFile with specified parameters.
|
Modifier and Type | Method and Description |
---|---|
@NotNull MappedBytesStore |
acquireByteStore(net.openhft.chronicle.core.io.ReferenceOwner owner,
long position,
BytesStore oldByteStore,
@NotNull MappedBytesStoreFactory mappedBytesStoreFactory)
Acquires the MappedBytesStore at the specified position
|
long |
actualSize()
Returns the actual size of this mapped file
|
long |
capacity()
Returns the capacity of this mapped file
|
long |
chunkCount()
Returns the number of chunks in this mapped file
|
void |
chunkCount(long[] chunkCount)
Fills the provided array with the number of chunks in this mapped file
|
long |
chunkSize()
Returns the size of chunks in this mapped file
|
MappedBytes |
createBytesFor()
Creates a new SingleMappedBytes for this mapped file
|
protected void |
finalize()
This finalize() is used to detect when a component is not released deterministically.
|
NewChunkListener |
getNewChunkListener()
Returns the listener that is notified when a new chunk is created.
|
FileLock |
lock(long position,
long size,
boolean shared)
Locks a region of this mapped file
|
long |
overlapSize()
Returns the size of overlaps in this mapped file
|
protected void |
performRelease()
Releases resources held by this mapped file
|
@NotNull RandomAccessFile |
raf()
Returns the RandomAccessFile of this mapped file
|
@NotNull String |
referenceCounts()
Returns a string representing the reference counts of this mapped file and its store
|
void |
setNewChunkListener(NewChunkListener listener)
Sets the listener to be notified when a new chunk is created.
|
void |
syncMode(SyncMode syncMode)
Sets the synchronization mode for the underlying MappedBytesStore
|
protected boolean |
threadSafetyCheck(boolean isUsed)
Performs a thread safety check on the component.
|
FileLock |
tryLock(long position,
long size,
boolean shared)
Attempts to lock a region of this mapped file
|
acquireBytesForRead, acquireBytesForRead, acquireBytesForWrite, acquireBytesForWrite, acquireByteStore, acquireByteStore, canReleaseInBackground, file, internalizedToken, mappedFile, mappedFile, mappedFile, mappedFile, mappedFile, mappedFile, of, ofSingle, readOnly, readOnly, warmup
backgroundPerformRelease, close, isClosed, release, releaseLast, reserve, reserveTransfer, setClosed, setClosing, throwExceptionIfClosed, throwExceptionIfClosedInSetter, tryReserve
addReferenceChangeListener, assertReferencesReleased, clearUsedByThread, createdHere, disableReferenceTracing, enableReferenceTracing, refCount, referenceCountedUnmonitored, referenceId, removeReferenceChangeListener, reservedBy, singleThreadedCheckDisabled, singleThreadedCheckReset, throwExceptionIfNotReleased, throwExceptionIfReleased, toString, unmonitor, warnAndReleaseIfNotReleased
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
public SingleMappedFile(@NotNull @NotNull File file, @NotNull @NotNull RandomAccessFile raf, long capacity, boolean readOnly) throws net.openhft.chronicle.core.io.IORuntimeException
file
- the file to be mapped.raf
- the RandomAccessFile associated with the file.capacity
- the capacity of the mapped file.readOnly
- if the file is read-only.net.openhft.chronicle.core.io.IORuntimeException
- if any I/O error occurs.public void syncMode(SyncMode syncMode)
syncMode
in class MappedFile
syncMode
- The synchronization mode to set@NotNull public @NotNull MappedBytesStore acquireByteStore(net.openhft.chronicle.core.io.ReferenceOwner owner, long position, BytesStore oldByteStore, @NotNull @NotNull MappedBytesStoreFactory mappedBytesStoreFactory) throws IllegalArgumentException
acquireByteStore
in class MappedFile
owner
- The owner of the MappedBytesStoreposition
- The position to acquireoldByteStore
- The old byte storemappedBytesStoreFactory
- The factory to use when creating new MappedBytesStoreIllegalArgumentException
- If position is not zeroprotected void performRelease()
performRelease
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
@NotNull public @NotNull String referenceCounts()
referenceCounts
in class MappedFile
public long capacity()
capacity
in class MappedFile
public long chunkSize()
chunkSize
in class MappedFile
public long overlapSize()
overlapSize
in class MappedFile
public NewChunkListener getNewChunkListener()
MappedFile
getNewChunkListener
in class MappedFile
public void setNewChunkListener(NewChunkListener listener)
MappedFile
setNewChunkListener
in class MappedFile
listener
- The listener to be set.public long actualSize() throws net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException
actualSize
in class MappedFile
net.openhft.chronicle.core.io.IORuntimeException
- If an I/O error occursIllegalStateException
- If this file is closed or an interruption occurs@NotNull public @NotNull RandomAccessFile raf()
raf
in class MappedFile
protected void finalize() throws Throwable
finalize
in class MappedFile
Throwable
protected boolean threadSafetyCheck(boolean isUsed)
MappedFile
threadSafetyCheck
in class MappedFile
isUsed
- Flag to indicate whether the component is used.public FileLock lock(long position, long size, boolean shared) throws IOException
lock
in class MappedFile
position
- The position at which to start the locked regionsize
- The size of the locked regionshared
- Whether the lock is sharedIOException
- If an I/O error occurspublic FileLock tryLock(long position, long size, boolean shared) throws IOException
tryLock
in class MappedFile
position
- The position at which to start the locked regionsize
- The size of the locked regionshared
- Whether the lock is sharedIOException
- If an I/O error occurspublic long chunkCount()
chunkCount
in class MappedFile
public void chunkCount(long[] chunkCount)
chunkCount
in class MappedFile
chunkCount
- The array to fillpublic MappedBytes createBytesFor()
createBytesFor
in class MappedFile
Copyright © 2023. All rights reserved.