org.compass.needle.terracotta
Class ManagedTerracottaLockAdapter
java.lang.Object
org.apache.lucene.store.Lock
org.compass.needle.terracotta.ManagedTerracottaLockAdapter
public class ManagedTerracottaLockAdapter
- extends Lock
An adapter ontop of a lock that releases the managed read lock when trying to obtain
a Lucene lock and obtains the read lock again once the Lucene lock obtain is done.
It is done in order to prevent dead locks when several clients/threads obtain the read lock
when the "transaction" starts, and they wait for the lucene lock without actually releasing the
read lock for other "write locks (the add file)" to be able to be obtained.
- Author:
- kimchy
Nested classes/interfaces inherited from class org.apache.lucene.store.Lock |
Lock.With |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ManagedTerracottaLockAdapter
public ManagedTerracottaLockAdapter(ReadWriteLock rwl,
Lock lock)
obtain
public boolean obtain(long lockWaitTimeout)
throws LockObtainFailedException,
IOException
- Overrides:
obtain
in class Lock
- Throws:
LockObtainFailedException
IOException
obtain
public boolean obtain()
throws IOException
- Specified by:
obtain
in class Lock
- Throws:
IOException
release
public void release()
throws IOException
- Specified by:
release
in class Lock
- Throws:
IOException
isLocked
public boolean isLocked()
- Specified by:
isLocked
in class Lock
Copyright (c) 2004-2009 The Compass Project.