Class GCGeneration


  • public final class GCGeneration
    extends java.lang.Object
    Instances of this class represent the garbage collection generation related information of a segment. It consists of the segment's generation, its full generation and its compaction flag. The segment's generation records the number of garbage collection cycles a segment went through and is incremented with every garbage collection regardless its type. The segment's full generation records the number of full garbage collection cycles a segment went through. It is only incremented on full garbage collection cycles. The segment's compaction flag is set for those segments that have been created by a compaction operation. It is never set for segments created by normal write operations or defer compactions triggered by such. Segments written by normal repository writes will inherit the generation and full generation of the segment written by the previous compaction process with the compacted flag cleared.

    The information recorded in this way allows to determine the reclamation status of a segment by just looking at the GCGeneration instances of that segment and of the segment containing the repository head: Let s be a segment, h be the segment containing the current repository head and n be the number of retained generations.

    • s is old iff h.generation - s.generation >= n
    • s is in the same compaction tail than h iff s.isCompacted && s.fullGeneration == h.fullGeneration
    • s is reclaimable iff s is old and s is not in the same compaction tail than h
    • Method Detail

      • newGCGeneration

        public static GCGeneration newGCGeneration​(int generation,
                                                   int fullGeneration,
                                                   boolean isCompacted)
      • getGeneration

        public int getGeneration()
      • getFullGeneration

        public int getFullGeneration()
      • isCompacted

        public boolean isCompacted()
      • nextFull

        @NotNull
        public @NotNull GCGeneration nextFull()
        Create a new instance with the generation and the full generation incremented by one and the compaction flag set.
      • nextTail

        @NotNull
        public @NotNull GCGeneration nextTail()
        Create a new instance with the generation incremented by one, the full generation left unchanged and the compaction flag set.
      • nextPartial

        @NotNull
        public @NotNull GCGeneration nextPartial()
        Create a new instance with the compaction flag set and the generation and the full generation left unchanged.
      • nonGC

        @NotNull
        public @NotNull GCGeneration nonGC()
        Create a new instance with the compaction flag unset and the generation and the full generation left unchanged.
      • compareWith

        public int compareWith​(@NotNull
                               @NotNull GCGeneration gcGeneration)
        Compare this generation with gcGeneration
        Parameters:
        gcGeneration - the generation this generation is compared against.
        Returns:
        Number of generations between this generation and gcGeneration
      • compareFullGenerationWith

        public int compareFullGenerationWith​(@NotNull
                                             @NotNull GCGeneration gcGeneration)
        Compare this full generation the full generation of gcGeneration
        Parameters:
        gcGeneration - the generation this generation is compared against.
        Returns:
        Number of generations between the full generations of this generation and gcGeneration
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object