public interface ISMLocking
ISMLocking
defines an interface for a locking strategy of an
ItemStateManager
.
An implementation of ISMLocking
must meet the following
requirements:
I
an
implementation must ensure that no write lock is issued for a change log
that contains a reference to an item with id I
.C
an
implementation must ensure that no read lock is issued for an item that is
contained in C
, unless the current thread is the owner of the
write lock!C
an
implementation must ensure that no write lock is issued for a change log
C'
that intersects with C
. 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.
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.Modifier and Type | Interface and Description |
---|---|
static interface |
ISMLocking.ReadLock |
static interface |
ISMLocking.WriteLock |
Modifier and Type | Method and Description |
---|---|
ISMLocking.ReadLock |
acquireReadLock(ItemId id)
Acquire a read lock for the given item
id . |
ISMLocking.WriteLock |
acquireWriteLock(ChangeLog changeLog)
Acquires a write lock for the given
changeLog . |
ISMLocking.ReadLock acquireReadLock(ItemId id) throws InterruptedException
id
.id
- an item id.InterruptedException
ISMLocking.WriteLock acquireWriteLock(ChangeLog changeLog) throws InterruptedException
changeLog
.changeLog
- the change logchangeLog
.InterruptedException
- if the thread is interrupted while creating
the write lock.Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.