public class MappedBufferStrategy extends DiskBackedBufferStrategy
Memory-mapped journal strategy (this mode is NOT recommended).
Note: the use of FileLock
with a memory-mapped file is NOT
recommended by the JDK as this combination is not permitted on some
platforms.
Note: Extension and truncation of a mapped file are not possible with the JDK
since there is no way to guarentee that the mapped file will be unmapped in a
timely manner. Journals that handle IJournal#overflow()
should
trigger overflow just a bit earlier for a MappedByteBuffer
in an
attempt to avoid running out of space in the journal. If a transaction can
not be committed due to overflow, it could be re-committed after
handling the overflow event (e.g., throw a "CommitRetryException").
The mapped mode has nearly the performance of the transient mode in some tests. However the use of mapped files might not prove worth the candle due to the difficulties with resource deallocation for this strategy and the good performance of some alternative strategies. There are also some other issues that have shown up in some of the tests suites -- look carefully if you are going to pursue this!
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038
,
BufferMode.Mapped
opener
extent, userExtent
bufferMode, commitOffset, ERR_ADDRESS_IS_NULL, ERR_ADDRESS_NOT_WRITTEN, ERR_BAD_RECORD_SIZE, ERR_BUFFER_EMPTY, ERR_BUFFER_NULL, ERR_BUFFER_OVERRUN, ERR_MAX_EXTENT, ERR_NOT_OPEN, ERR_OPEN, ERR_READ_ONLY, ERR_RECORD_LENGTH_ZERO, ERR_TRUNCATE, initialExtent, log, maximumExtent, nextOffset, WARN
am
NULL
Modifier and Type | Method and Description |
---|---|
void |
close()
The file channel is closed, but according to
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038 there is no
way to guarentee when the mapped file will be released.
|
void |
deleteResources()
Overrides the default behavior so that an exception is NOT thrown if the
file can not be deleted.
|
void |
force(boolean metadata)
Force the data to disk.
|
boolean |
isFullyBuffered()
True iff the store is fully buffered (all reads are against memory).
|
void |
truncate(long newExtent)
Note: Extension and truncation of a mapped file are not possible with the
JDK since there is no way to guarentee that the mapped file will be
unmapped in a timely manner.
|
delete, getChannel, getFile, getHeaderSize, getRandomAccessFile, isStable, read, readRootBlock, setNextOffset, transferTo, writeRootBlock
getBufferView, getCounters, getExtent, getUserExtent, write
abort, assertOpen, closeForWrites, commit, destroy, getBufferMode, getInitialExtent, getMaximumExtent, getMaxRecordSize, getMetaBitsAddr, getMetaStartAddr, getMinimumExtension, getNextOffset, getResourceMetadata, getUUID, isDirty, isOpen, isReadOnly, overflow, requiresCommit, size, transferFromDiskTo, useChecksums
getAddressManager, getByteCount, getOffset, getOffsetBits, getPhysicalAddress, toAddr, toString
getInputStream, getOutputStream
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
abort, closeForWrites, commit, getAddressManager, getBufferMode, getCounters, getExtent, getInitialExtent, getMaximumExtent, getMaxRecordSize, getMetaBitsAddr, getMetaStartAddr, getNextOffset, getOffsetBits, getUserExtent, isDirty, requiresCommit, useChecksums
destroy, getResourceMetadata, getUUID, isOpen, isReadOnly, size, write
getByteCount, getOffset, getPhysicalAddress, toAddr, toString
getInputStream, getOutputStream
public boolean isFullyBuffered()
IRawStore
Note: This does not guarantee that the OS will not swap the buffer onto disk.
public void force(boolean metadata)
force
in interface IRawStore
force
in class DiskBackedBufferStrategy
metadata
- If true, then force both the file contents and the file
metadata to disk.MappedByteBuffer.force()
public void close()
close
in interface IRawStore
close
in class DiskBackedBufferStrategy
public void deleteResources()
deleteResources
in interface IRawStore
deleteResources
in class DiskBackedBufferStrategy
public void truncate(long newExtent)
truncate
in interface IBufferStrategy
truncate
in class BasicBufferStrategy
newExtent
- The new extent of the journal. This value represent the total
extent of the journal, including any root blocks together with
the user extent.UnsupportedOperationException
- Always thrown.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.