Package org.graylog2.shared.journal
Class NoopJournal
java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
org.graylog2.shared.journal.NoopJournal
- All Implemented Interfaces:
com.google.common.util.concurrent.Service,Journal
public class NoopJournal
extends com.google.common.util.concurrent.AbstractIdleService
implements Journal
NoopJournal is used when disk journalling is turned off. In order to avoid propagating the knowledge about whether
journalling is happening or not, we inject a no-op journal.
Any use of this journal will throw an IllegalStateException.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.graylog2.shared.journal.Journal
Journal.Entry, Journal.JournalReadEntryNested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateEntry(byte[] idBytes, byte[] messageBytes) voidflush()voidmarkJournalOffsetCommitted(long offset) read(long maximumCount) intExecutes the retention policy on the journal, deleting outdated or excess data based on the configured retention rules.protected voidshutDown()protected voidstartUp()longwrite(byte[] idBytes, byte[] messageBytes) longwrite(List<Journal.Entry> entries) Methods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.graylog2.shared.journal.Journal
getJournalUtilization
-
Constructor Details
-
NoopJournal
public NoopJournal()
-
-
Method Details
-
createEntry
- Specified by:
createEntryin interfaceJournal
-
write
-
write
public long write(byte[] idBytes, byte[] messageBytes) -
read
-
markJournalOffsetCommitted
public void markJournalOffsetCommitted(long offset) - Specified by:
markJournalOffsetCommittedin interfaceJournal
-
startUp
- Specified by:
startUpin classcom.google.common.util.concurrent.AbstractIdleService- Throws:
Exception
-
shutDown
- Specified by:
shutDownin classcom.google.common.util.concurrent.AbstractIdleService- Throws:
Exception
-
flush
public void flush() -
runRetention
public int runRetention()Description copied from interface:JournalExecutes the retention policy on the journal, deleting outdated or excess data based on the configured retention rules.- Specified by:
runRetentionin interfaceJournal- Returns:
- an integer representing the amount of data deleted during the retention process.
-