Class TableLoggerImpl2<T extends WritableRowContainer>

All Implemented Interfaces:
Direct Known Subclasses:

public abstract class TableLoggerImpl2<T extends WritableRowContainer> extends Object implements TableLogger
Common parts of the generated TableLoggers. It is "2" so that we can change the implementation details from TableLoggerImpl; and existing client code will still compile. Otherwise, there is a chicken and egg problem, with clients not being able to run the new TableLoggerFactory using modules that contain their logger classes.
  • Field Details

    • writer

      protected TableWriter writer
    • setterPool

      protected PoolEx<T extends WritableRowContainer> setterPool
    • isClosed

      protected volatile boolean isClosed
    • isShuttingDown

      protected volatile boolean isShuttingDown
    • outstandingSetters

      protected final AtomicInteger outstandingSetters
  • Constructor Details

    • TableLoggerImpl2

      public TableLoggerImpl2(String tablename)
  • Method Details

    • init

      public final void init(TableWriter tableWriter, int queueSize) throws IOException
      Specified by:
      init in interface TableLogger
    • createSetter

      protected abstract T createSetter()
    • threadName

      protected abstract String threadName()
    • isInitialized

      protected final boolean isInitialized()
    • verifyCondition

      protected final void verifyCondition(boolean condition, String message)
      Check the condition and throw an IllegalStateException if it is not met.
      condition - the condition to check
      message - useful information for the IllegalStateException
      IllegalStateException - if the condition is false
    • shutdown

      public final void shutdown()
      Description copied from interface: TableLogger
      Write all enqueued elements to the TableWriter and prevent further writes. This should be invoked before TableLogger.close(). This must not be invoked if any threads might still try to log additional items.
      Specified by:
      shutdown in interface TableLogger
    • flush

      protected final void flush(T setter)
    • waitDone

      public final void waitDone()
      Wait for all currently populated rows to be written.
    • waitDone

      public final boolean waitDone(long millis)
    • close

      public final void close() throws IOException
      Description copied from interface: TableLogger
      Close the logger and any writer in use. Users should quiesce all logging threads and invoke TableLogger.shutdown() first in order to guarantee that all pending rows have been written to storage.
      Specified by:
      close in interface TableLogger
      IOException - if an error occurred closing the logger.
    • isClosed

      public final boolean isClosed()
      Specified by:
      isClosed in interface TableLogger