Class Sweep2StatusDocument
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.Sweep2StatusDocument
-
public class Sweep2StatusDocument extends java.lang.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 long
acquireOrUpdateSweep2Lock(DocumentStore documentStore, int clusterId, boolean forceSweepingStatus)
Acquires the sweep2 lock.static boolean
forceReleaseSweep2LockAndMarkSwept(DocumentStore documentStore, int clusterId)
Release the sweep2 lock and record swept2 successful.int
getLockClusterId()
long
getLockValue()
java.lang.Integer
getSweptById()
boolean
isChecking()
boolean
isSweeping()
boolean
isSwept()
static Sweep2StatusDocument
readFrom(DocumentStore documentStore)
java.lang.String
toString()
-
-
-
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 java.lang.Integer getSweptById()
-
getLockValue
public long getLockValue()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-