org.apache.cassandra.db.commitlog

## Class AbstractCommitLogSegmentManager

- java.lang.Object
- - org.apache.cassandra.db.commitlog.AbstractCommitLogSegmentManager

- Direct Known Subclasses:
    CommitLogSegmentManagerCDC, CommitLogSegmentManagerStandard

      public abstract class AbstractCommitLogSegmentManager
      extends java.lang.Object

  Performs eager-creation of commit log segments in a background thread. All the public methods are thread safe.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected CommitLog` | `commitLog`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract CommitLogSegment.Allocation` | `allocate(Mutation mutation, int size)` Allocate a segment within this CLSM.
    `void` | `awaitTermination()` Returns when the management thread terminates.
    `java.util.Collection<CommitLogSegment>` | `getActiveSegments()`
    `long` | `onDiskSize()`
    `void` | `shutdown()` Initiates the shutdown process for the management thread.
    `void` | `stopUnsafe(boolean deleteSegments)` Stops CL, for testing purposes.
    `void` | `sync(boolean flush)` Requests commit log files sync themselves, if needed.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### commitLog

          protected final CommitLog commitLog

  - ### Method Detail

    - #### allocate

          public abstract CommitLogSegment.Allocation allocate(Mutation mutation,
                                                               int size)

      Allocate a segment within this CLSM. Should either succeed or throw.

    - #### onDiskSize

          public long onDiskSize()

      Returns:
        the space (in bytes) used by all segment files.

    - #### stopUnsafe

          public void stopUnsafe(boolean deleteSegments)

      Stops CL, for testing purposes. DO NOT USE THIS OUTSIDE OF TESTS. Only call this after the AbstractCommitLogService is shut down.

    - #### shutdown

          public void shutdown()

      Initiates the shutdown process for the management thread.

    - #### awaitTermination

          public void awaitTermination()
                                throws java.lang.InterruptedException

      Returns when the management thread terminates.
      Throws:
        `java.lang.InterruptedException`

    - #### getActiveSegments

          public java.util.Collection<CommitLogSegment> getActiveSegments()

      Returns:
        a read-only collection of the active commit log segments

    - #### sync

          public void sync(boolean flush)
                    throws java.io.IOException

      Requests commit log files sync themselves, if needed. This may or may not involve flushing to disk.
      Parameters:
        `flush` - Request that the sync operation flush the file to disk.
      Throws:
        `java.io.IOException`

Copyright © 2018 The Apache Software Foundation