org.apache.lucene.store.jdbc.lock
Class PhantomReadLock

java.lang.Object
  extended by org.apache.lucene.store.Lock
      extended by org.apache.lucene.store.jdbc.lock.PhantomReadLock
All Implemented Interfaces:
JdbcLock

public class PhantomReadLock
extends Lock
implements JdbcLock

A lock based on phantom reads and table level locking. For most database and most transaction isolation levels this lock is suffecient.

The existance of the lock in the database, marks it as being locked.

The benefits of using this lock is the ability to release it.

Author:
kimchy

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.store.Lock
Lock.With
 
Field Summary
 
Fields inherited from class org.apache.lucene.store.Lock
failureReason, LOCK_OBTAIN_WAIT_FOREVER, LOCK_POLL_INTERVAL
 
Constructor Summary
PhantomReadLock()
           
 
Method Summary
 void configure(JdbcDirectory jdbcDirectory, String name)
          Configures the lock.
 void initializeDatabase(JdbcDirectory jdbcDirectory)
          Called without configure.
 boolean isLocked()
           
 boolean obtain()
           
 void release()
           
 String toString()
           
 
Methods inherited from class org.apache.lucene.store.Lock
obtain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PhantomReadLock

public PhantomReadLock()
Method Detail

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 lock
name - The name of the lock
Throws:
IOException

initializeDatabase

public void initializeDatabase(JdbcDirectory jdbcDirectory)
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

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-2009 The Compass Project.