public class SingleMappedFile extends MappedFile
DEFAULT_SYNC_MODE, newChunkListener, RETAIN| Constructor and Description |
|---|
SingleMappedFile(@NotNull File file,
@NotNull RandomAccessFile raf,
long capacity,
boolean readOnly) |
SingleMappedFile(@NotNull File file,
@NotNull RandomAccessFile raf,
long capacity,
int pageSize,
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, of, ofSingle, readOnly, readOnly, warmupbackgroundPerformRelease, close, isClosed, release, releaseLast, reserve, reserveTransfer, setClosed, setClosing, throwExceptionIfClosed, throwExceptionIfClosedInSetter, tryReserveaddReferenceChangeListener, assertReferencesReleased, clearUsedByThread, createdHere, disableReferenceTracing, enableReferenceTracing, refCount, referenceCountedUnmonitored, referenceId, removeReferenceChangeListener, reservedBy, singleThreadedCheckDisabled, singleThreadedCheckReset, throwExceptionIfNotReleased, throwExceptionIfReleased, toString, unmonitor, warnAndReleaseIfNotReleasedclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic SingleMappedFile(@NotNull
@NotNull File file,
@NotNull
@NotNull RandomAccessFile raf,
long capacity,
int pageSize,
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 SingleMappedFile(@NotNull
@NotNull File file,
@NotNull
@NotNull RandomAccessFile raf,
long capacity,
boolean readOnly)
throws net.openhft.chronicle.core.io.IORuntimeException
net.openhft.chronicle.core.io.IORuntimeExceptionpublic void syncMode(SyncMode syncMode)
syncMode in class MappedFilesyncMode - 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, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
acquireByteStore in class MappedFileowner - 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 zeronet.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayprotected void performRelease()
performRelease in class net.openhft.chronicle.core.io.AbstractReferenceCounted@NotNull public @NotNull String referenceCounts()
referenceCounts in class MappedFilepublic long capacity()
capacity in class MappedFilepublic long chunkSize()
chunkSize in class MappedFilepublic long overlapSize()
overlapSize in class MappedFilepublic NewChunkListener getNewChunkListener()
MappedFilegetNewChunkListener in class MappedFilepublic void setNewChunkListener(NewChunkListener listener)
MappedFilesetNewChunkListener in class MappedFilelistener - The listener to be set.public long actualSize()
throws net.openhft.chronicle.core.io.IORuntimeException,
IllegalStateException
actualSize in class MappedFilenet.openhft.chronicle.core.io.IORuntimeException - If an I/O error occursnet.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateException@NotNull public @NotNull RandomAccessFile raf()
raf in class MappedFileprotected void finalize()
throws Throwable
finalize in class MappedFileThrowableprotected boolean threadSafetyCheck(boolean isUsed)
MappedFilethreadSafetyCheck in class MappedFileisUsed - Flag to indicate whether the component is used.public FileLock lock(long position, long size, boolean shared) throws IOException
lock in class MappedFileposition - 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 MappedFileposition - 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 MappedFilepublic void chunkCount(long[] chunkCount)
chunkCount in class MappedFilechunkCount - The array to fillpublic MappedBytes createBytesFor()
createBytesFor in class MappedFileCopyright © 2023. All rights reserved.