Class FlashJournalRM
- All Implemented Interfaces:
Disposable, BinaryStoreManager, ClassLoaderAware, JournalMBean, Controllable, AutoCloseable
To use the Resource Manager, configure it using Dependency Injection by
passing in the populated dependency object at instantiation. Once configured,
start the Resource Manager via the AbstractJournalRM.start() method, and then obtain BinaryStore instances via the AbstractJournalRM.createBinaryStore()
method. When a BinaryStore instance is no longer required, dispose of it
via the Disposable interface, and similarly stop() or AbstractJournalRM.dispose() of the Resource Manager when it is no longer
needed to ensure that any resources it allocated are cleaned up and
released.
While the Resource Manager is running, there will be one or more files created in the specified temporary directory (or the default temporary directory if none is specified). The number of files is not related to the number of BinaryStore instances, but rather to the total amount of data that the Resource Manager is managing at any given time. Additionally, the Resource Manager uses three daemon threads to help manage the data: "Journal-Preparer", "Journal-Writer" and "Journal-Collector". These threads respectively lay out the data to be written, write the data, and perform asynchronous GC of the storage files.
The limits on the journal are as follows:
- Values are limited by default to 64MB;
- An individual file is limited by default to 2GB (and maximum 4GB);
- A journal is composed of up to 512 files;
- A journal is thus limited by default to 1TB, with a theoretical maximum of 2TB
- Since:
- Coherence 3.7
- Author:
- cp/cf 2010-06-10
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classA Buffer is a handy shell with some helper methods around a byte[] and a ByteBuffer.protected static classThe BufferPool class recycles up to a maximum number of Buffer objects.protected static classA CongestionPolicy defines how to behave when the currently activeFlashJournalRM.JournalFilebecomes congested.protected classJournal-wide wall-clock congestion statistics.static classThe DefaultDependencies class provides a default implementation of Dependencies.static interfaceThe Dependencies interface provides a FlashJournalRM object with its external dependencies.protected static classAFlashJournalRM.CongestionPolicythat fails, by throwing an unchecked exception, whenFlashJournalRM.FailCongestionPolicy.onCongestion(FlashJournalRM.JournalFile)is invoked.protected static classResettable FlashJournal file creation and deletion statistics.protected classA JournalFile is created for each OS file used to store the journal contents.protected classThe PreparerDaemon takes the enqueued Binary values for the JournalFile objects, and lays them out in Buffer objects from the BufferPool, enqueuing them for the WriterDaemon to write.protected static classAFlashJournalRM.CongestionPolicywhich blocks the current thread on theFlashJournalRM.JournalFile's monitor until awoken.protected classThe WriterDaemon takes the enqueued Buffer objects from the PreparerDaemon, and appends them to a JournalFile.protected static classCumulative statistics for the FlashJournal writer.Nested classes/interfaces inherited from class AbstractJournalRM
AbstractJournalRM.CollectorDaemon, AbstractJournalRM.JournalImpl -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final FlashJournalRM.WriterStatisticsEmpty statistics returned while the writer daemon is not running.protected static final FlashJournalRM.FailCongestionPolicyAFlashJournalRM.CongestionPolicywhich fails, by throwing an unchecked exception, when the file is deemed congested.static final StringIOException message.protected AtomicIntegerTotal amount of data enqueued to be written.protected FlashJournalRM.CongestionPolicyTheFlashJournalRM.CongestionPolicyto be used when in a congested state.protected FlashJournalRM.PreparerDaemonThe "rendering" thread that renders (copies and encrypts) the queued binaries into buffers to be written.protected FlashJournalRM.WriterDaemonThe "writing" thread that just does appends of prepared buffers to journal files.protected FileDirectory to store the temporary files.protected booleanSet to true after the directory location has been logged.protected final AtomicLongCompletion time of the most recent collector scan.protected final AtomicLongCreation time of the most recently created file.protected final AtomicLongDeletion time of the most recently deleted file.protected final AtomicLongNon-resetting sequence assigned to successfully constructed files.protected ConcurrentMap<Long, Binary> Map of locators to Binary values that have been queued to be written.protected FlashJournalRM.BufferPoolThe BufferPool of Buffer objects that are used to format data to append to the journal.protected final FlashJournalRM.CongestionStatisticsJournal-wide congestion statistics.protected FlashJournalRM.FileLifecycleStatisticsResettable file lifecycle statistics.protected static final longThe 64-bit bitmask for the file index.protected static final longThe 64-bit bitmask for the value length.protected static final longThe 64-bit bitmask for the value offset.protected static final intThe location of the file id within the ticket.protected static final intThe location of the value-length within the ticket.protected static final intThe location of the value-offset within the ticket.protected static final intFrom an encoding point of view, the raw offset is shifted four bits less than necessary, because the four least significant bits of the offset are always zero (due to paragraph alignment).protected static final booleanA flag used for flash journal testing.protected static final StringA simple name to be used as part of MBean ObjectNames.protected static final FlashJournalRM.WaitCongestionPolicyThe default congestion policy which blocks the client thread until awoken by theFlashJournalRM.WriterDaemon.Fields inherited from class AbstractJournalRM
DEDUPE_ENABLED, f_ajournalfileCondition, f_ajournalfileLock, f_journalRMCondition, f_journalRMLock, JOURNAL_FULL_MESSAGE, m_ajournalfile, m_cJournalFiles, m_daemonCollector, m_dblFileSizeFactor, m_dependencies, m_dflHighestLoadFactor, m_jrnlfile, m_loader, m_nState, m_setJournals, MASK_COMPACT_FLAG, MASK_COMPACT_LENGTH, SHIFT_COMPACT_FLAG, SHIFT_COMPACT_LENGTH, STATE_CONFIGURED, STATE_INITIAL, STATE_RUNNING, STATE_STOPPED, STATE_STOPPING -
Constructor Summary
ConstructorsConstructorDescriptionFlashJournalRM(Cluster cluster, FlashJournalRM.Dependencies deps) Construct a FlashJournalRM. -
Method Summary
Modifier and TypeMethodDescriptionprotected doubleCalculate current load factor for compaction (GC).protected booleanAttempt to claim exclusive ownership of deleting the file underlying a FlashJournal file.Clone the Dependencies object.protected FileCreate the temporary file underlying a FlashJournal file.protected booleandeleteJournalFile(File file) Delete the file underlying a FlashJournal file.protected longencodeTicket(int nFile, long of, int cb) Encode a file number, offset and length into a "ticket".protected intextractFileId(long lTicket) Extract a file index (a file ID) from the passed ticket.protected intextractLength(long lTicket) Extract a file offset from the passed ticket.protected longextractOffset(long lTicket) Extract a file offset from the passed ticket.protected FlashJournalRM.JournalFileReturn the oldest journal file that is still active.intDetermine the number of serialized values that have not yet been persisted to disk.intDetermine the total size in bytes of the serialized values that have not yet been persisted to disk.protected FlashJournalRM.BufferPoolObtain the BufferPool instance.intDetermine the size of the buffers used to write a chunk of data at a time to an underlying journal file.longDetermine the elapsed time of the current FlashJournal congestion episode, or zero if the journal is not congested.Return the Dependencies object.protected StringFormat the object attributes into a String for inclusion in the String returned from theAbstractJournalRM.toString()method.Determine the directory used to store the underlying disk files for the journal.protected longObtain the bit mask that is used to identify tickets that need to be evacuated for a particular file id.intDetermine the high file count for this Journal.protected FlashJournalRM.JournalFilegetJournalFile(int nFileId) Obtain a JournalFile by its ID.intDetermine the maximum allowable size, in bytes, of the backlog; when the backlog reaches this level, writes are delayed until the backlog drops below its maximum.longDetermine the longest continuous FlashJournal congestion episode.longDetermine the longest physicalFileChannel.forceinvocation.longDetermine the longest physicalFileChannel.writeinvocation.longDetermine the maximum size (in bytes) of the buffers that can be held by the pool.longDetermine the total amount, in bytes, of RAM that will be used for the Journal.longDetermine when the FlashJournal collector most recently completed a scan and successfully finalized its results.longDetermine the most recently assigned, non-resetting FlashJournal file creation sequence number.longDetermine the creation time of the most recently created FlashJournal file.longDetermine the deletion time of the most recently deleted FlashJournal managed file.protected StringgetName()Returns the name value to be used in MBean Objectname key "name".longDetermine the non-resetting creation sequence number assigned to the oldest currently active FlashJournal file.longDetermine the creation time of the oldest currently active FlashJournal file.intDetermine the size (in bytes) of the buffers that are currently available in the pool.protected FlashJournalRM.PreparerDaemonObtain the PreparerDaemon instance.longReturn the delay since the last touch of a tmp file until it is eligible for purging.longDetermine the number of FlashJournal congestion episodes.longDetermine the cumulative wall-clock time during which the FlashJournal was unable to accept new values because of write-backlog congestion.longDetermine the number of FlashJournal files successfully created since statistics were reset.longDetermine the number of failed FlashJournal file or channel creation attempts since statistics were reset.longDetermine the number of managed FlashJournal files successfully deleted since statistics were reset.longDetermine the number of failed managed FlashJournal file deletion attempts since statistics were reset, including attempts for whichFile.delete()returnedfalse.longDetermine the number of write errors thrown by physicalFileChannel.writeinvocations.longDetermine the total number of physicalFileChannel.forceinvocations attempted by the FlashJournal writer.longDetermine the number of write errors thrown by physicalFileChannel.forceinvocations.longDetermine the cumulative time spent in physicalFileChannel.forceinvocations.longDetermine the total number of bytes reported written by physicalFileChannel.writeinvocations, including recovery writes.longDetermine the total number of I/O exceptions thrown by physical write or force operations.longDetermine the total number of physicalFileChannel.writeinvocations attempted by the FlashJournal writer.longDetermine the number of recovery attempts made after a physical write or force operation failed.longDetermine the cumulative time spent in physicalFileChannel.writeinvocations.protected FlashJournalRM.WriterDaemonObtain the WriterDaemon instance.protected FlashJournalRM.WriterStatisticsObtain the current writer statistics.protected longReturn the number of milliseconds the Writer daemon can be unresponsive prior to considering it timed out.protected FlashJournalRM.BufferPoolFactory: Instantiate a pool of buffers.protected FlashJournalRM.JournalFileinstantiateJournalFile(int nFile) Factory: Instantiate a JournalFile or subclass thereof.protected FlashJournalRM.PreparerDaemonFactory: Instantiate a PreparerDaemon.protected FlashJournalRM.WriterDaemonFactory: Instantiate a WriterDaemon.booleanisNioRam()Determine if the journal will use direct buffers (NIO RAM) instead of on-heap buffers (byte arrays).protected voidCalled after the collector completes a scan and publishes its results.protected voidProcess the Dependencies after they have been injected into this object.protected voidDelete any old temp files that weren't cleaned up properly by a previous are configured to be "deleted on exit", it is possible that the temp files would not have been deleted if the JVM crashed or if there was a fault at the physical machine level.voidReset the journal statistics.protected booleanCheck if the Collector daemon needs to be notified to come out of sleepprotected voidCreate and start the various threads used by this Journal Resource Manager.voidstop()Hard-stop the controllable service.protected voidStop the various threads used by this Journal Resource Manager.Methods inherited from class AbstractJournalRM
close, compact, configure, createBinaryStore, createJournal, destroyBinaryStore, dispose, encodeTicket, ensureCurrentJournalFile, extractBinary, getBinaryStoreCount, getCluster, getCollectorDaemon, getCollectorLoadFactor, getCollectorTimeout, getCompactionCount, getContextClassLoader, getCurrentCollectorLoadFactor, getCurrentCompactionTime, getExhaustiveCompactionCount, getExhaustiveCompactionTime, getFileCount, getGuardian, getHighestLoadFactor, getMaxCollectorSleepMillis, getMaxFileSize, getMaximumCompactionTime, getMaxJournalFiles, getMaxJournalFilesNumber, getMaxJournalSize, getMaxValueSize, getMinCollectorSleepMillis, getState, getStateDescription, getSurvivorFile, getTicketDescription, getTotalCompactionAttemptCount, getTotalCompactionBytes, getTotalCompactionTime, getTotalDataSize, getTotalFileSize, instantiateCollectorDaemon, instantiateJournal, isCompact, isDedupEnabled, isRunning, isSingleEvacuation, iterateJournalFiles, iterateJournals, registerJournal, registerMBean, setContextClassLoader, setState, shutdown, start, toString, unregisterJournal, unregisterMBean
-
Field Details
-
SHIFT_FILE_ID
protected static final int SHIFT_FILE_IDThe location of the file id within the ticket.- See Also:
-
MASK_FILE_ID
protected static final long MASK_FILE_IDThe 64-bit bitmask for the file index. The 9 bits from 62-54.- See Also:
-
SHIFT_OFFSET
protected static final int SHIFT_OFFSETThe location of the value-offset within the ticket.- See Also:
-
SHIFT_OFFSET_RAW
protected static final int SHIFT_OFFSET_RAWFrom an encoding point of view, the raw offset is shifted four bits less than necessary, because the four least significant bits of the offset are always zero (due to paragraph alignment).- See Also:
-
MASK_OFFSET
protected static final long MASK_OFFSETThe 64-bit bitmask for the value offset. The 28 bits 53-26.Note that the least significant four bits of the offset MUST ALWAYS be zero, because they are NOT encoded into the ticket -- hence the 16-byte paragraph boundary for entries.
- See Also:
-
SHIFT_LENGTH
protected static final int SHIFT_LENGTHThe location of the value-length within the ticket.- See Also:
-
MASK_LENGTH
protected static final long MASK_LENGTHThe 64-bit bitmask for the value length. The 26 bits 25-0.- See Also:
-
TYPE_NAME
A simple name to be used as part of MBean ObjectNames.- See Also:
-
EMPTY_WRITER_STATISTICS
Empty statistics returned while the writer daemon is not running. -
WAIT_CONGESTION_ACTION
The default congestion policy which blocks the client thread until awoken by theFlashJournalRM.WriterDaemon. -
FAIL_CONGESTION_ACTION
AFlashJournalRM.CongestionPolicywhich fails, by throwing an unchecked exception, when the file is deemed congested. -
SIMULATE_DISK_FULL
protected static final boolean SIMULATE_DISK_FULLA flag used for flash journal testing.- Since:
- 12.2.1.4.26
-
IO_EXCEPTION_MESSAGE
IOException message. Used to check for IOException in the error message.- Since:
- 12.2.1.4.26
- See Also:
-
m_congestionPolicy
TheFlashJournalRM.CongestionPolicyto be used when in a congested state. -
m_statsCongestion
Journal-wide congestion statistics. -
m_statsFileLifecycle
Resettable file lifecycle statistics.- Since:
- 26.1.0.0
-
m_lFileCreationSequence
Non-resetting sequence assigned to successfully constructed files.- Since:
- 26.1.0.0
-
m_ldtMostRecentFileCreation
Creation time of the most recently created file.- Since:
- 26.1.0.0
-
m_ldtMostRecentFileDeletion
Deletion time of the most recently deleted file.- Since:
- 26.1.0.0
-
m_ldtMostRecentCollectorScanCompletion
Completion time of the most recent collector scan.- Since:
- 26.1.0.0
-
m_dirTemp
Directory to store the temporary files. -
m_fLoggedDirectory
protected boolean m_fLoggedDirectorySet to true after the directory location has been logged. -
m_cbBacklog
Total amount of data enqueued to be written. -
m_mapLocators
Map of locators to Binary values that have been queued to be written. A "locator" is a ticket without an encoded length. -
m_pool
The BufferPool of Buffer objects that are used to format data to append to the journal. -
m_daemonPreparer
The "rendering" thread that renders (copies and encrypts) the queued binaries into buffers to be written. -
m_daemonWriter
The "writing" thread that just does appends of prepared buffers to journal files.
-
-
Constructor Details
-
FlashJournalRM
Construct a FlashJournalRM.- Parameters:
cluster- theClusterfor which theFlashJournalRMis storing datadeps- the Dependencies object
-
-
Method Details
-
stop
public void stop()Hard-stop the controllable service. UseControllable.shutdown()for normal service termination. Calling this method for a service that has already stopped has no effect.- Specified by:
stopin interfaceControllable- Overrides:
stopin classAbstractJournalRM
-
getMaxTotalRam
public long getMaxTotalRam()Determine the total amount, in bytes, of RAM that will be used for the Journal.This property is specific to a
RamJournalRMimplementation.- Returns:
- the maximum number of bytes that will be allocated for Journal storage
-
isNioRam
public boolean isNioRam()Determine if the journal will use direct buffers (NIO RAM) instead of on-heap buffers (byte arrays).This property is specific to a
RamJournalRMimplementation.- Returns:
- true iff the journal is configured to use NIO "direct buffer" RAM
-
getMaxBacklogSize
public int getMaxBacklogSize()Determine the maximum allowable size, in bytes, of the backlog; when the backlog reaches this level, writes are delayed until the backlog drops below its maximum.This property is specific to a
FlashJournalRMimplementation.- Returns:
- the maximum allowable size of the backlog
-
getBacklogSize
public int getBacklogSize()Determine the total size in bytes of the serialized values that have not yet been persisted to disk. This value is also referred to as the "backlog".This property is specific to a
FlashJournalRMimplementation.- Returns:
- the number of bytes queued to be written
-
getBacklogCount
public int getBacklogCount()Determine the number of serialized values that have not yet been persisted to disk.This property is specific to a
FlashJournalRMimplementation.- Returns:
- the number of serialized values queued to be written
-
getBufferSize
public int getBufferSize()Determine the size of the buffers used to write a chunk of data at a time to an underlying journal file.This property is specific to a
FlashJournalRMimplementation.- Returns:
- the size, in bytes, of each buffer
-
getMaxPoolSize
public long getMaxPoolSize()Determine the maximum size (in bytes) of the buffers that can be held by the pool. This is not a limit of how many buffers can be allocated, since some may be in use at any time, but rather how many will be held by the pool (i.e. recycled) as they are released.- Returns:
- the maximum size in bytes of all of the buffers that the buffer pool can hold onto
-
getOldestActiveFileCreationTime
public long getOldestActiveFileCreationTime()Description copied from interface:JournalMBeanDetermine the creation time of the oldest currently active FlashJournal file. Active files are appending, congested, full, or evacuating; garbage and discarded files are excluded. This lifetime value is not changed byJournalMBean.resetStatistics().- Returns:
- the creation time in epoch milliseconds, or zero if there is no
active file, or
-1if unsupported
-
getOldestActiveFileCreationSequenceNumber
public long getOldestActiveFileCreationSequenceNumber()Description copied from interface:JournalMBeanDetermine the non-resetting creation sequence number assigned to the oldest currently active FlashJournal file. Active files are appending, congested, full, or evacuating; garbage and discarded files are excluded.- Returns:
- the creation sequence number, or zero if there is no active
file, or
-1if unsupported
-
getMostRecentFileCreationTime
public long getMostRecentFileCreationTime()Description copied from interface:JournalMBeanDetermine the creation time of the most recently created FlashJournal file. This lifetime value is not changed byJournalMBean.resetStatistics().- Returns:
- the creation time in epoch milliseconds, or zero if no file has
been created, or
-1if unsupported
-
getMostRecentFileCreationSequenceNumber
public long getMostRecentFileCreationSequenceNumber()Description copied from interface:JournalMBeanDetermine the most recently assigned, non-resetting FlashJournal file creation sequence number.- Returns:
- the creation sequence number, or zero if no file has been
created, or
-1if unsupported
-
getTotalFileCreationCount
public long getTotalFileCreationCount()Description copied from interface:JournalMBeanDetermine the number of FlashJournal files successfully created since statistics were reset.- Returns:
- the successful file creation count, or
-1if unsupported
-
getTotalFileCreationErrors
public long getTotalFileCreationErrors()Description copied from interface:JournalMBeanDetermine the number of failed FlashJournal file or channel creation attempts since statistics were reset.- Returns:
- the failed file creation count, or
-1if unsupported
-
getMostRecentFileDeletionTime
public long getMostRecentFileDeletionTime()Description copied from interface:JournalMBeanDetermine the deletion time of the most recently deleted FlashJournal managed file. This lifetime value is not changed byJournalMBean.resetStatistics().- Returns:
- the deletion time in epoch milliseconds, or zero if no file has
been deleted, or
-1if unsupported
-
getTotalFileDeletionCount
public long getTotalFileDeletionCount()Description copied from interface:JournalMBeanDetermine the number of managed FlashJournal files successfully deleted since statistics were reset.- Returns:
- the successful file deletion count, or
-1if unsupported
-
getTotalFileDeletionErrors
public long getTotalFileDeletionErrors()Description copied from interface:JournalMBeanDetermine the number of failed managed FlashJournal file deletion attempts since statistics were reset, including attempts for whichFile.delete()returnedfalse.- Returns:
- the failed file deletion count, or
-1if unsupported
-
getMostRecentCollectorScanCompletionTime
public long getMostRecentCollectorScanCompletionTime()Description copied from interface:JournalMBeanDetermine when the FlashJournal collector most recently completed a scan and successfully finalized its results. This lifetime value is not changed byJournalMBean.resetStatistics().- Returns:
- the scan completion time in epoch milliseconds, or zero if no
scan has completed, or
-1if unsupported
-
getPoolSize
public int getPoolSize()Determine the size (in bytes) of the buffers that are currently available in the pool. This is not a measurement of how many buffers are currently in use or how many have been allocated.This property is specific to a
FlashJournalRMimplementation.- Returns:
- the total size in bytes of all of the buffers that are currently in the buffer pool
-
getHighFileCount
public int getHighFileCount()Determine the high file count for this Journal. Compulsory compaction (GC) occurs when the journal file count reaches the high file count.This property is specific to a
FlashJournalRMimplementation.- Returns:
- the high file count for this journal
-
getTotalWriteOperationCount
public long getTotalWriteOperationCount()Description copied from interface:JournalMBeanDetermine the total number of physicalFileChannel.writeinvocations attempted by the FlashJournal writer. A scatter/gather invocation counts as one operation regardless of the number of buffers.- Returns:
- the total number of physical write operations
-
getTotalWriteBytes
public long getTotalWriteBytes()Description copied from interface:JournalMBeanDetermine the total number of bytes reported written by physicalFileChannel.writeinvocations, including recovery writes.- Returns:
- the total number of bytes reported written
-
getTotalWriteTime
public long getTotalWriteTime()Description copied from interface:JournalMBeanDetermine the cumulative time spent in physicalFileChannel.writeinvocations.- Returns:
- the cumulative write time in milliseconds
-
getMaximumWriteTime
public long getMaximumWriteTime()Description copied from interface:JournalMBeanDetermine the longest physicalFileChannel.writeinvocation.- Returns:
- the maximum write time in milliseconds
-
getTotalForceCount
public long getTotalForceCount()Description copied from interface:JournalMBeanDetermine the total number of physicalFileChannel.forceinvocations attempted by the FlashJournal writer.- Returns:
- the total number of force operations
-
getTotalForceTime
public long getTotalForceTime()Description copied from interface:JournalMBeanDetermine the cumulative time spent in physicalFileChannel.forceinvocations.- Returns:
- the cumulative force time in milliseconds
-
getMaximumForceTime
public long getMaximumForceTime()Description copied from interface:JournalMBeanDetermine the longest physicalFileChannel.forceinvocation.- Returns:
- the maximum force time in milliseconds
-
getTotalWriteErrors
public long getTotalWriteErrors()Description copied from interface:JournalMBeanDetermine the total number of I/O exceptions thrown by physical write or force operations.- Returns:
- the total number of write-path errors
-
getTotalFileWriteErrors
public long getTotalFileWriteErrors()Description copied from interface:JournalMBeanDetermine the number of write errors thrown by physicalFileChannel.writeinvocations.- Returns:
- the total number of physical write errors
-
getTotalForceErrors
public long getTotalForceErrors()Description copied from interface:JournalMBeanDetermine the number of write errors thrown by physicalFileChannel.forceinvocations.- Returns:
- the total number of force errors
-
getTotalWriteRetries
public long getTotalWriteRetries()Description copied from interface:JournalMBeanDetermine the number of recovery attempts made after a physical write or force operation failed.- Returns:
- the total number of write retries
-
getTotalCongestionCount
public long getTotalCongestionCount()Description copied from interface:JournalMBeanDetermine the number of FlashJournal congestion episodes. A congestion episode begins when the journal stops accepting new values because its write backlog exceeded the configured maximum.- Returns:
- the total number of congestion episodes
-
getTotalCongestionTime
public long getTotalCongestionTime()Description copied from interface:JournalMBeanDetermine the cumulative wall-clock time during which the FlashJournal was unable to accept new values because of write-backlog congestion. Concurrent producers blocked by the same congestion episode do not multiply this value.- Returns:
- the cumulative congestion time in milliseconds
-
getMaximumCongestionTime
public long getMaximumCongestionTime()Description copied from interface:JournalMBeanDetermine the longest continuous FlashJournal congestion episode.- Returns:
- the maximum congestion time in milliseconds
-
getCurrentCongestionTime
public long getCurrentCongestionTime()Description copied from interface:JournalMBeanDetermine the elapsed time of the current FlashJournal congestion episode, or zero if the journal is not congested.- Returns:
- the current congestion time in milliseconds
-
resetStatistics
public void resetStatistics()Description copied from class:AbstractJournalRMReset the journal statistics.- Specified by:
resetStatisticsin interfaceJournalMBean- Overrides:
resetStatisticsin classAbstractJournalRM
-
findOldestActiveJournalFile
Return the oldest journal file that is still active. Appending, congested, full, and evacuating files are active; garbage and discarded files are not.- Returns:
- the oldest active journal file, or
null - Since:
- 26.1.0.0
-
onCollectorScanCompleted
protected void onCollectorScanCompleted()Description copied from class:AbstractJournalRMCalled after the collector completes a scan and publishes its results.- Overrides:
onCollectorScanCompletedin classAbstractJournalRM
-
getDirectoryFile
Determine the directory used to store the underlying disk files for the journal.- Returns:
- the directory that is used to hold the journal files, or null if the default temporary directory is used
-
getPurgeDelayMillis
public long getPurgeDelayMillis()Return the delay since the last touch of a tmp file until it is eligible for purging. Tmp files are purged at startup of the FlashJournalRM to clean up tmp files from a previous instance of the FlashJournalRM.- Returns:
- the delay in milliseconds
-
getName
Returns the name value to be used in MBean Objectname key "name".- Specified by:
getNamein classAbstractJournalRM- Returns:
- the name
-
getWriterTimeout
protected long getWriterTimeout()Return the number of milliseconds the Writer daemon can be unresponsive prior to considering it timed out.- Returns:
- the number of milliseconds the Writer can be unresponsive
-
getDependencies
Return the Dependencies object.- Overrides:
getDependenciesin classAbstractJournalRM- Returns:
- the journal dependencies object
-
cloneDependencies
Clone the Dependencies object.- Specified by:
cloneDependenciesin classAbstractJournalRM- Parameters:
deps- the populated Dependencies object- Returns:
- the cloned Dependencies object
-
onDependencies
Process the Dependencies after they have been injected into this object.- Overrides:
onDependenciesin classAbstractJournalRM- Parameters:
deps- the populated Dependencies object
-
startThreads
protected void startThreads()Create and start the various threads used by this Journal Resource Manager.- Overrides:
startThreadsin classAbstractJournalRM
-
purgeOldTempFiles
protected void purgeOldTempFiles()Delete any old temp files that weren't cleaned up properly by a previous are configured to be "deleted on exit", it is possible that the temp files would not have been deleted if the JVM crashed or if there was a fault at the physical machine level. -
stopThreads
protected void stopThreads()Stop the various threads used by this Journal Resource Manager.- Overrides:
stopThreadsin classAbstractJournalRM
-
calculateCurrentLoadFactor
protected double calculateCurrentLoadFactor()Calculate current load factor for compaction (GC).- Overrides:
calculateCurrentLoadFactorin classAbstractJournalRM- Returns:
- calculated load factor
-
shouldNotifyCollector
protected boolean shouldNotifyCollector()Check if the Collector daemon needs to be notified to come out of sleep- Overrides:
shouldNotifyCollectorin classAbstractJournalRM- Returns:
- true if collector daemon should be notified
-
getDescription
Format the object attributes into a String for inclusion in the String returned from theAbstractJournalRM.toString()method.- Overrides:
getDescriptionin classAbstractJournalRM- Returns:
- a comma-delimited String listing the attributes of this object in the form "attribute=value"
-
getJournalFile
Obtain a JournalFile by its ID.- Overrides:
getJournalFilein classAbstractJournalRM- Parameters:
nFileId- the file id (0-511)- Returns:
- the JournalFile for that file id, or null if there is currently no JournalFile for that file id
-
instantiateJournalFile
Factory: Instantiate a JournalFile or subclass thereof.- Specified by:
instantiateJournalFilein classAbstractJournalRM- Parameters:
nFile- the file number in the range 0-511 (inclusive)- Returns:
- a new JournalFile instance
-
createTemporaryJournalFile
Create the temporary file underlying a FlashJournal file.- Returns:
- the temporary file
- Throws:
IOException- if the file cannot be created- Since:
- 26.1.0.0
-
deleteJournalFile
Delete the file underlying a FlashJournal file.- Parameters:
file- the file to delete- Returns:
trueif the file was deleted- Since:
- 26.1.0.0
-
claimJournalFileDeletion
Attempt to claim exclusive ownership of deleting the file underlying a FlashJournal file.- Parameters:
file- the journal file- Returns:
trueif deletion ownership was acquired- Since:
- 26.1.0.0
-
instantiateBufferPool
Factory: Instantiate a pool of buffers.- Returns:
- a BufferPool or subclass thereof
-
getBufferPool
Obtain the BufferPool instance.- Returns:
- the BufferPool for this FlashJournalRM
-
instantiatePreparerDaemon
Factory: Instantiate a PreparerDaemon.- Returns:
- a PreparerDaemon or a sub-class thereof
-
getPreparerDaemon
Obtain the PreparerDaemon instance.- Returns:
- the PreparerDaemon for this FlashJournalRM
-
instantiateWriterDaemon
Factory: Instantiate a WriterDaemon.- Returns:
- a WriterDaemon or a sub-class thereof
-
getWriterDaemon
Obtain the WriterDaemon instance.- Returns:
- the WriterDaemon for this FlashJournalRM
-
getWriterStatistics
Obtain the current writer statistics.- Returns:
- the current writer statistics
- Since:
- 26.1.0.0
-
getEvacuationMask
protected long getEvacuationMask()Obtain the bit mask that is used to identify tickets that need to be evacuated for a particular file id.- Specified by:
getEvacuationMaskin classAbstractJournalRM- Returns:
- the bit mask for the file index within a ticket and whatever other bits are necessary to ensure that a ticket refers to that file
-
extractFileId
protected int extractFileId(long lTicket) Extract a file index (a file ID) from the passed ticket.- Specified by:
extractFileIdin classAbstractJournalRM- Parameters:
lTicket- a "ticket" that was created by the Journal- Returns:
- the file index for the value represented by that ticket
-
extractOffset
protected long extractOffset(long lTicket) Extract a file offset from the passed ticket.- Specified by:
extractOffsetin classAbstractJournalRM- Parameters:
lTicket- a "ticket" that was created by the Journal- Returns:
- the file offset for the value represented by that ticket
-
extractLength
protected int extractLength(long lTicket) Extract a file offset from the passed ticket.- Specified by:
extractLengthin classAbstractJournalRM- Parameters:
lTicket- a "ticket" that was created by the Journal- Returns:
- the file offset for the value represented by that ticket
-
encodeTicket
protected long encodeTicket(int nFile, long of, int cb) Encode a file number, offset and length into a "ticket".- Specified by:
encodeTicketin classAbstractJournalRM- Parameters:
nFile- a file number (aka a file index)of- a value offsetcb- a value length- Returns:
- a "ticket" containing the file number, offset and length
-