Issue Details (XML | Word | Printable)

Key: LUCENE-305
Type: Improvement Improvement
Status: Closed Closed
Resolution: Duplicate
Priority: Minor Minor
Assignee: Yonik Seeley
Reporter: Jeff Patterson
Votes: 2
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Lucene - Java

[PATCH] Lock Framework - allows custom lock mechanism

Created: 10/Nov/04 02:08 PM   Updated: 31/Aug/06 02:29 AM
Return to search
Component/s: Store
Affects Version/s: unspecified
Fix Version/s: 2.1

Time Tracking:
Not Specified

File Attachments:
  Size
Java Source File FSDirectory.java 2004-11-10 02:12 PM Jeff Patterson 15 kB
Text File FSDirectory_patch_file.txt 2004-11-10 02:12 PM Jeff Patterson 3 kB
Java Source File Lock.java 2004-11-10 02:18 PM Jeff Patterson 4 kB
Text File Lock_patch_file.txt 2004-11-10 02:13 PM Jeff Patterson 1 kB
Java Source File LockFactory.java 2004-11-10 02:19 PM Jeff Patterson 3 kB
Java Source File MySQLLocker.java 2004-11-10 02:20 PM Jeff Patterson 6 kB
Environment:
Operating System: other
Platform: All
Issue Links:
Reference
 

Bugzilla Id: 32143
Resolution Date: 31/Aug/06 02:29 AM


 Description  « Hide
Proposal: Pluggable Lock Framework for Lucene
Date: Nov 2004
Developer: Jeff Patterson (jeffATwebdoyen.com - http://www.webdoyen.com)

------

Abstract: A framework to allow Lucene users to override the default
FileSystem locking mechanism with a custom lock mechanism.

A Lucene user may develop a new class that extends
org.apache.lucene.store.Lock and implement bodies for the following
methods:
public boolean obtain() - to obtain custom lock
public boolean isLocked() - to detect custom lock
public void release() - to release custom lock

NOTE: When implementing these methods, the developer should make sure to
use the this.getLockName() method on the Lock to identify which lock
is being manipulated (see Modified Files below for more).

After developed, the new class must be added to the classpath (along
with any other supporting classes/libraries needed by the new class),
and the Lucene framework must be alerted of the new class by way of
the "org.apache.lucene.lockClass" -D System property. Example:

java -Dorg.apache.lucene.lockClass=foo.MyCustomLocker LuceneTest

------

Modified Files: The following files were modified to support
this framework (DIFF files at end):

  • org.apache.lucene.store.Lock
    The member "lockName" and an accompanying protected getter and
    setter were added to this class to support naming the lock. This
    is transparent to the default lock mechanism and is only useful
    when writing a custom lock.
  • org.apache.lucene.store.FSDirectory
    Instead of instantiating a default Lock, this class now checks
    to see if an overridden Lock mechanism is provided, and if so
    asks the LockFactory (see below) to provide an overridden Lock
    class.

New Files: The following files were added to support this framework:

  • org.apache.lucene.store.LockFactory
    This class is used to reflect and instantiate by name the custom
    Lock implementation. Error handing should be modified in this
    class, but that would have required a more extensive code overhaul.
    The javadocs for the LockFactory contain a skeleton Java file for
    a custom lock implementation.

------



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no subversion log entries for this issue yet.