Class Sweep2StatusDocument
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.Sweep2StatusDocument
-
public class Sweep2StatusDocument extends Object
Represents the sweep2 status as recorded in the settings collection.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static longacquireOrUpdateSweep2Lock(DocumentStore documentStore, int clusterId, boolean forceSweepingStatus)Acquires the sweep2 lock.static booleanforceReleaseSweep2LockAndMarkSwept(DocumentStore documentStore, int clusterId)Release the sweep2 lock and record swept2 successful.intgetLockClusterId()longgetLockValue()IntegergetSweptById()booleanisChecking()booleanisSweeping()booleanisSwept()static Sweep2StatusDocumentreadFrom(DocumentStore documentStore)StringtoString()
-
-
-
Method Detail
-
readFrom
public static Sweep2StatusDocument readFrom(DocumentStore documentStore)
-
acquireOrUpdateSweep2Lock
public static long acquireOrUpdateSweep2Lock(DocumentStore documentStore, int clusterId, boolean forceSweepingStatus)
Acquires the sweep2 lock.- Parameters:
documentStore-clusterId-forceSweepingStatus- if false uses the default way to set the sweep2-status, if set to true (force-)sets sweep2-status to 'sweeping'. the latter can be used if the caller knows a sweeping is necessary and wants to skip the 'checking' phase explicitly- Returns:
- -1 if a sweep2 is definitely not necessary (already swept)
- 0 if the lock could not be acquired (another instance got in between)
- > 0 if a lock was acquired (in which case this returned value is the lock value, which is always > 0)
-
forceReleaseSweep2LockAndMarkSwept
public static boolean forceReleaseSweep2LockAndMarkSwept(DocumentStore documentStore, int clusterId)
Release the sweep2 lock and record swept2 successful. Note that the clusterId is only for recording purpose - this method makes no checks on the current owner of the lock- Parameters:
documentStore-clusterId-- Returns:
- true if the sweep2 status is now marked swept(2) - false if that failed (in the latter case the caller can consider retrying the acquire/sweep2/release sequence)
-
isSwept
public boolean isSwept()
-
isSweeping
public boolean isSweeping()
-
isChecking
public boolean isChecking()
-
getLockClusterId
public int getLockClusterId()
-
getSweptById
public Integer getSweptById()
-
getLockValue
public long getLockValue()
-
-