Class JournalFilesRepository
java.lang.Object
org.apache.activemq.artemis.core.journal.impl.JournalFilesRepository
This is a helper class for the Journal, which will control access to dataFiles, openedFiles and freeFiles
Guaranteeing that they will be delivered in order to the Journal
-
Constructor Summary
ConstructorsConstructorDescriptionJournalFilesRepository(SequentialFileFactory fileFactory, JournalImpl journal, String filePrefix, String fileExtension, int userVersion, int maxAIO, int fileSize, int minFiles, int poolSize, int journalFileOpenTimeout, int maxAtticFiles) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddDataFileOnTop(JournalFile file) voidaddFreeFile(JournalFile file, boolean renameTmp) voidaddFreeFile(JournalFile file, boolean renameTmp, boolean checkDelete) add a free filevoidcalculateNextfileID(List<JournalFile> files) voidvoidclear()voidvoidcloseFile(JournalFile file, boolean block) createRemoteBackupSyncFile(long fileID) Creates files for journal synchronization of a replicated backup.voidintstatic longgetFileNameID(String filePrefix, String fileName) Get the ID part of the nameintintintintintopenFile()This method will instantly return the opened file, and schedule opening and reclaiming.voidopenFile(JournalFile file, boolean multiAIO) voidOpen a file and place it into the openedFiles queuevoidremoveDataFile(JournalFile file) voidremoveNegatives(JournalFile file) voidsetExecutor(Executor fileExecutor) voidsetNextFileID(long targetUpdate) Set the {link #nextFileID} value totargetUpdateif the current value is less thantargetUpdate.toString()
-
Constructor Details
-
JournalFilesRepository
public JournalFilesRepository(SequentialFileFactory fileFactory, JournalImpl journal, String filePrefix, String fileExtension, int userVersion, int maxAIO, int fileSize, int minFiles, int poolSize, int journalFileOpenTimeout, int maxAtticFiles)
-
-
Method Details
-
getPoolSize
public int getPoolSize() -
setExecutor
-
clear
- Throws:
Exception
-
getMaxAIO
public int getMaxAIO() -
getFileExtension
-
getFilePrefix
-
calculateNextfileID
-
setNextFileID
public void setNextFileID(long targetUpdate) Set the {link #nextFileID} value totargetUpdateif the current value is less thantargetUpdate.Notice that
nextFileIDis incremented before being used, seegenerateFileID(). -
ensureMinFiles
- Throws:
Exception
-
openFile
- Throws:
Exception
-
getDataFilesArray
-
pollLastDataFile
-
removeDataFile
-
getDataFilesCount
public int getDataFilesCount() -
getJournalFileOpenTimeout
public int getJournalFileOpenTimeout() -
getDataFiles
-
clearDataFiles
public void clearDataFiles() -
addDataFileOnTop
-
debugFiles
-
checkDataFiles
public void checkDataFiles() -
addDataFileOnBottom
-
getFreeFilesCount
public int getFreeFilesCount() -
addFreeFile
- Throws:
Exception
-
addFreeFile
add a free file- Parameters:
renameTmp- - should rename the file as it's being added to free filescheckDelete- - should delete the file if max condition has been met- Throws:
Exception
-
getFreeFiles
-
getFreeFile
-
getOpenedFilesCount
public int getOpenedFilesCount() -
openFileCMP
- Throws:
Exception
-
openFile
This method will instantly return the opened file, and schedule opening and reclaiming.In case there are no cached opened files, this method will block until the file was opened, what would happen only if the system is under heavy load by another system (like a backup system, or a DB sharing the same box as ActiveMQ).
- Throws:
ActiveMQIOErrorException- In case the file could not be openedInterruptedException
-
pushOpenedFile
Open a file and place it into the openedFiles queue- Throws:
Exception
-
closeFile
- Throws:
Exception
-
createRemoteBackupSyncFile
Creates files for journal synchronization of a replicated backup.In order to simplify synchronization, the file IDs in the backup match those in the live server.
- Parameters:
fileID- the fileID to use when creating the file.- Throws:
Exception
-
getFileNameID
Get the ID part of the name -
removeNegatives
-
toString
-