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.JournalReadEntry

    Nested 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createEntry(byte[] idBytes, byte[] messageBytes)
     
    void
     
    void
     
    read(long maximumCount)
     
    protected void
     
    protected void
     
    long
    write(byte[] idBytes, byte[] messageBytes)
     
    long
     

    Methods inherited from class com.google.common.util.concurrent.AbstractIdleService

    addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • NoopJournal

      public NoopJournal()
  • Method Details

    • createEntry

      public Journal.Entry createEntry(byte[] idBytes, byte[] messageBytes)
      Specified by:
      createEntry in interface Journal
    • write

      public long write(List<Journal.Entry> entries)
      Specified by:
      write in interface Journal
    • write

      public long write(byte[] idBytes, byte[] messageBytes)
      Specified by:
      write in interface Journal
    • read

      public List<Journal.JournalReadEntry> read(long maximumCount)
      Specified by:
      read in interface Journal
    • markJournalOffsetCommitted

      public void markJournalOffsetCommitted(long offset)
      Specified by:
      markJournalOffsetCommitted in interface Journal
    • startUp

      protected void startUp() throws Exception
      Specified by:
      startUp in class com.google.common.util.concurrent.AbstractIdleService
      Throws:
      Exception
    • shutDown

      protected void shutDown() throws Exception
      Specified by:
      shutDown in class com.google.common.util.concurrent.AbstractIdleService
      Throws:
      Exception
    • flush

      public void flush()
      Specified by:
      flush in interface Journal