Class GcLog


  • class GcLog
    extends java.lang.Object
    This class manages the gc.log file for a FileRepository.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean autoGcBlockedByOldLockFile()  
      (package private) boolean commit()
      Commit changes to the gc log, if there have been any writes.
      private java.time.Instant getLogExpiry()  
      (package private) boolean lock()
      Lock the GC log file for updates
      (package private) void unlock()
      Unlock (roll back) the GC log lock
      (package private) void write​(java.lang.String content)
      Write to the pending gc log.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logFile

        private final java.io.File logFile
      • gcLogExpire

        private java.time.Instant gcLogExpire
      • LOG_EXPIRY_DEFAULT

        private static final java.lang.String LOG_EXPIRY_DEFAULT
        See Also:
        Constant Field Values
      • nonEmpty

        private boolean nonEmpty
    • Method Detail

      • getLogExpiry

        private java.time.Instant getLogExpiry()
                                        throws java.text.ParseException
        Throws:
        java.text.ParseException
      • autoGcBlockedByOldLockFile

        private boolean autoGcBlockedByOldLockFile()
      • lock

        boolean lock()
        Lock the GC log file for updates
        Returns:
        true if we hold the lock
      • unlock

        void unlock()
        Unlock (roll back) the GC log lock
      • commit

        boolean commit()
        Commit changes to the gc log, if there have been any writes. Otherwise, just unlock and delete the existing file (if any)
        Returns:
        true if committing (or unlocking/deleting) succeeds.
      • write

        void write​(java.lang.String content)
            throws java.io.IOException
        Write to the pending gc log. Content will be committed upon a call to commit()
        Parameters:
        content - The content to write
        Throws:
        java.io.IOException