org.apache.lucene.store

Class LockFactory

Known Direct Subclasses:
NativeFSLockFactory, NoLockFactory, SimpleFSLockFactory, SingleInstanceLockFactory

public abstract class LockFactory
extends Object

Base class for Locking implementation. Directory uses instances of this class to implement locking.

Field Summary

protected String
lockPrefix

Method Summary

abstract void
clearLock(String lockName)
Attempt to clear (forcefully unlock and remove) the specified lock.
String
getLockPrefix()
Get the prefix in use for all locks created in this LockFactory.
abstract Lock
makeLock(String lockName)
Return a new Lock instance identified by lockName.
void
setLockPrefix(String lockPrefix)
Set the prefix in use for all locks created in this LockFactory.

Field Details

lockPrefix

protected String lockPrefix

Method Details

clearLock

public abstract void clearLock(String lockName)
            throws IOException
Attempt to clear (forcefully unlock and remove) the specified lock. Only call this at a time when you are certain this lock is no longer in use.
Parameters:
lockName - name of the lock to be cleared.

getLockPrefix

public String getLockPrefix()
Get the prefix in use for all locks created in this LockFactory.

makeLock

public abstract Lock makeLock(String lockName)
Return a new Lock instance identified by lockName.
Parameters:
lockName - name of the lock to be created.

setLockPrefix

public void setLockPrefix(String lockPrefix)
Set the prefix in use for all locks created in this LockFactory. This is normally called once, when a Directory gets this LockFactory instance. However, you can also call this (after this instance is assigned to a Directory) to override the prefix in use. This is helpful if you're running Lucene on machines that have different mount points for the same shared directory.

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.