Class GcLog
java.lang.Object
org.eclipse.jgit.internal.storage.file.GcLog
This class manages the gc.log file for a
FileRepository.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Instantprivate final LockFileprivate static final Stringprivate final Fileprivate booleanprivate final FileRepository -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean(package private) booleancommit()Commit changes to the gc log, if there have been any writes.private Instant(package private) booleanlock()Lock the GC log file for updates(package private) voidunlock()Unlock (roll back) the GC log lock(package private) voidWrite to the pending gc log.
-
Field Details
-
repo
-
logFile
-
lock
-
gcLogExpire
-
LOG_EXPIRY_DEFAULT
- See Also:
-
nonEmpty
private boolean nonEmpty
-
-
Constructor Details
-
GcLog
GcLog(FileRepository repo) Construct a GcLog object for aFileRepository- Parameters:
repo- the repository
-
-
Method Details
-
getLogExpiry
- Throws:
ParseException
-
autoGcBlockedByOldLockFile
private boolean autoGcBlockedByOldLockFile() -
lock
boolean lock()Lock the GC log file for updates- Returns:
trueif 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
Write to the pending gc log. Content will be committed upon a call to commit()- Parameters:
content- The content to write- Throws:
IOException
-