lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Lu" <chris...@gmail.com>
Subject Re: Clearing locks
Date Mon, 05 Mar 2007 05:34:52 GMT
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


Mime
View raw message