lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Clearing locks
Date Mon, 05 Mar 2007 21:13:29 GMT

there are also the static IndexReder.isLocked(Directory) and
IndexReder.unlock(Directory) methods that encapsulate this logic for you
... they've been around since at least 1.4.3.


: Date: Sun, 4 Mar 2007 21:34:52 -0800
: From: Chris Lu <chris.lu@gmail.com>
: Reply-To: java-user@lucene.apache.org
: To: java-user@lucene.apache.org
: Subject: Re: Clearing locks
:
: They are not really unique. Here are my code to unlock the directory.
: Notice there are two locks.
:
:     public static void unlockDirectory(Directory dir) {
:         Lock dirLock = dir.makeLock(IndexWriter.WRITE_LOCK_NAME);
:         if (dirLock.isLocked()) {
:             logger.debug("unlocking " + dirLock);
:             dirLock.release();
:             logger.info("unlocked directory " + dir);
:         }
:         dirLock = dir.makeLock(IndexWriter.COMMIT_LOCK_NAME);
:         if (dirLock.isLocked()) {
:             logger.debug("unlocking " + dirLock);
:             dirLock.release();
:             logger.info("unlocked directory " + dir);
:         }
:     }
:
: --
: Chris Lu
: -------------------------
: Instant Full-Text Search On Any Database/Application
: site: http://www.dbsight.net
: demo: http://search.dbsight.com
:
: On 3/4/07, MC Moisei <mcmoisei@comcast.net> wrote:
: > How do I clear the locks ? THey have unique names and the name changes
: > everytime...
: >
: > Chris Lu wrote:
: > > A safe way to do this is to clear the locks just before starting your
: > > war file.
: > >
: >
: >
: > ---------------------------------------------------------------------
: > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
: > For additional commands, e-mail: java-user-help@lucene.apache.org
: >
: >
:
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
: For additional commands, e-mail: java-user-help@lucene.apache.org
:



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message