Package org.apache.jackrabbit.core.state
Interface ISMLocking
-
- All Known Implementing Classes:
DefaultISMLocking
,FineGrainedISMLocking
public interface ISMLocking
ISMLocking
defines an interface for a locking strategy of anItemStateManager
.An implementation of
ISMLocking
must meet the following requirements:- While a read lock is held for a given item with id
I
an implementation must ensure that no write lock is issued for a change log that contains a reference to an item with idI
. - While a write lock is held for a given change log
C
an implementation must ensure that no read lock is issued for an item that is contained inC
, unless the current thread is the owner of the write lock! - While a write lock is held for a given change log
C
an implementation must ensure that no write lock is issued for a change logC'
that intersects withC
. That is both change logs contain a reference to the same item. Please note that an implementation is free to block requests entirely for additional write lock while a write lock is active. It is not a requirement to support concurrent write locks. - While a write lock is held for a change log
C
, the holder of the write lock (and any related threads) needs to be able to acquire a read lock even if other writers are waiting for the lock. This behaviour must continue also when the write lock has been downgraded. Note that it is not necessary for a holder of a read lock to be able to upgrade to a write lock.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ISMLocking.ReadLock
static interface
ISMLocking.WriteLock
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ISMLocking.ReadLock
acquireReadLock(ItemId id)
Acquire a read lock for the given itemid
.ISMLocking.WriteLock
acquireWriteLock(ChangeLog changeLog)
Acquires a write lock for the givenchangeLog
.
-
-
-
Method Detail
-
acquireReadLock
ISMLocking.ReadLock acquireReadLock(ItemId id) throws InterruptedException
Acquire a read lock for the given itemid
.- Parameters:
id
- an item id.- Throws:
InterruptedException
-
acquireWriteLock
ISMLocking.WriteLock acquireWriteLock(ChangeLog changeLog) throws InterruptedException
Acquires a write lock for the givenchangeLog
.- 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.
-
-