Package org.apache.jackrabbit.core.state
Class DefaultISMLocking
- java.lang.Object
-
- org.apache.jackrabbit.core.state.DefaultISMLocking
-
- All Implemented Interfaces:
ISMLocking
public class DefaultISMLocking extends Object implements ISMLocking
Default item state locking strategy. The default strategy is simply to use a single coarse-grained read-write lock over the entire workspace.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jackrabbit.core.state.ISMLocking
ISMLocking.ReadLock, ISMLocking.WriteLock
-
-
Constructor Summary
Constructors Constructor Description DefaultISMLocking()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ISMLocking.ReadLock
acquireReadLock(ItemId id)
Increments the reader count and returns the acquired read lock once there are no more writers or the current writer shares the thread id with this reader.ISMLocking.WriteLock
acquireWriteLock(ChangeLog changeLog)
Increments the writer count, sets the writer identifier and returns the acquired write lock once there are no other active readers or writers or the current writer shares the thread id with this writer.boolean
isWriterPreference()
Returns the writer preference status of this locking strategy.void
setWriterPreference(boolean preference)
Sets the writer preference status of this locking strategy.
-
-
-
Method Detail
-
isWriterPreference
public boolean isWriterPreference()
Returns the writer preference status of this locking strategy.- Returns:
- writer preference
-
setWriterPreference
public void setWriterPreference(boolean preference)
Sets the writer preference status of this locking strategy.- Parameters:
preference
- writer preference
-
acquireReadLock
public ISMLocking.ReadLock acquireReadLock(ItemId id) throws InterruptedException
Increments the reader count and returns the acquired read lock once there are no more writers or the current writer shares the thread id with this reader.- Specified by:
acquireReadLock
in interfaceISMLocking
- Parameters:
id
- an item id.- Throws:
InterruptedException
-
acquireWriteLock
public ISMLocking.WriteLock acquireWriteLock(ChangeLog changeLog) throws InterruptedException
Increments the writer count, sets the writer identifier and returns the acquired write lock once there are no other active readers or writers or the current writer shares the thread id with this writer.- Specified by:
acquireWriteLock
in interfaceISMLocking
- Parameters:
changeLog
- the change log- Returns:
- the write lock for the given
changeLog
. - Throws:
InterruptedException
- if the thread is interrupted while creating the write lock.
-
-