Class DefaultIndexLockService
- java.lang.Object
-
- com.atlassian.confluence.internal.index.lucene.DefaultIndexLockService
-
- All Implemented Interfaces:
IndexLockService
@LuceneIndependent public class DefaultIndexLockService extends Object implements IndexLockService
The implementation ofIndexLockService
which initialises all lock in memory. This is what we need for indexes which are stored locally and are accessed only from this JVM. Please note:EnumSet
guarantees iteration order, therefore lock ordering will automatically prevent deadlocks- Since:
- 7.9.0
-
-
Constructor Summary
Constructors Constructor Description DefaultIndexLockService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
lock(SearchIndex index)
Blocks to acquire a lock onindex
.void
lock(EnumSet<SearchIndex> indices)
Blocks to acquire a lock onindices
.boolean
tryLock(SearchIndex index, long duration, TimeUnit timeUnit)
Tries to acquire a lock on theindex
in given time limit.boolean
tryLock(EnumSet<SearchIndex> indices, long duration, TimeUnit timeUnit)
Tries to acquire a lock onindices
in given time limit.void
unlock(SearchIndex index)
Releases the lock held onindex
void
unlock(EnumSet<SearchIndex> indices)
Releases the lock held onindices
.
-
-
-
Method Detail
-
tryLock
public boolean tryLock(SearchIndex index, long duration, TimeUnit timeUnit)
Description copied from interface:IndexLockService
Tries to acquire a lock on theindex
in given time limit.- Specified by:
tryLock
in interfaceIndexLockService
- Returns:
- true if the lock was successfully acquired
-
tryLock
public boolean tryLock(EnumSet<SearchIndex> indices, long duration, TimeUnit timeUnit)
Description copied from interface:IndexLockService
Tries to acquire a lock onindices
in given time limit. The invocation of this method should work in all-or-nothing way, no partial subset of the locks should be acquired.- Specified by:
tryLock
in interfaceIndexLockService
- Returns:
- true if all locks were successfully acquired.
-
lock
public void lock(SearchIndex index)
Description copied from interface:IndexLockService
Blocks to acquire a lock onindex
.- Specified by:
lock
in interfaceIndexLockService
-
lock
public void lock(EnumSet<SearchIndex> indices)
Description copied from interface:IndexLockService
Blocks to acquire a lock onindices
. The invocation of this method should work in all-or-nothing way, no partial subset of the locks should be acquired.- Specified by:
lock
in interfaceIndexLockService
-
unlock
public void unlock(SearchIndex index)
Description copied from interface:IndexLockService
Releases the lock held onindex
- Specified by:
unlock
in interfaceIndexLockService
-
unlock
public void unlock(EnumSet<SearchIndex> indices)
Description copied from interface:IndexLockService
Releases the lock held onindices
. The invocation of this method should work in all-or-nothing way, no partial subset of the locks should be released.- Specified by:
unlock
in interfaceIndexLockService
-
-