org.apache.lucene.store.jdbc.lock
Class SelectForUpdateLock
java.lang.Object
org.apache.lucene.store.Lock
org.apache.lucene.store.jdbc.lock.SelectForUpdateLock
- All Implemented Interfaces:
- JdbcLock
public class SelectForUpdateLock
- extends Lock
- implements JdbcLock
A lock based on select...for update.
Note, that not all databases support select ... for update, if the database (dialect) does not support it,
a exception will be thrown (see Dialect.supportsForUpdate() .
Also note, that when using select for update locking, when the database is created, the commit and write
locks will be created and the select for update will be performed on them. If one wishes to switch to
PhantomReadLock, they must be manually deleted.
The lock is released when the transaction is committed, and not when the release method is called.
- Author:
- kimchy
| Nested classes/interfaces inherited from class org.apache.lucene.store.Lock |
Lock.With |
| Methods inherited from class org.apache.lucene.store.Lock |
obtain |
SelectForUpdateLock
public SelectForUpdateLock()
configure
public void configure(JdbcDirectory jdbcDirectory,
String name)
throws IOException
- Description copied from interface:
JdbcLock
- Configures the lock. Called just after the lock is instantiated.
- Specified by:
configure in interface JdbcLock
- Parameters:
jdbcDirectory - The directory using the lockname - The name of the lock
- Throws:
IOException
initializeDatabase
public void initializeDatabase(JdbcDirectory jdbcDirectory)
throws IOException
- Description copied from interface:
JdbcLock
- Called without configure. Should initialize a creates database.
- Specified by:
initializeDatabase in interface JdbcLock
- Parameters:
jdbcDirectory - The directory owning the lock
- Throws:
IOException
obtain
public boolean obtain()
- Specified by:
obtain in class Lock
release
public void release()
- Specified by:
release in class Lock
isLocked
public boolean isLocked()
- Specified by:
isLocked in class Lock
toString
public String toString()
- Overrides:
toString in class Object
Copyright (c) 2004-2008 The Compass Project.