@Override public final Lock obtainLock(String name) throws IOException { return lockFactory.obtainLock(this, name); }
public synchronized void clearLock(String lockName) throws IOException { lf.clearLock(lockName); } }
lockFactory.setLockPrefix("test"); Lock l = verifyLF.makeLock("test.lock");
/** * Set the LockFactory that this Directory instance should * use for its locking implementation. Each * instance of * LockFactory should only be used for one directory (ie, * do not share a single instance across multiple * Directories). * * @param lockFactory instance of {@link LockFactory}. */ public void setLockFactory(LockFactory lockFactory) { this.lockFactory = lockFactory; lockFactory.setLockPrefix(this.getLockID()); }
/** Construct a {@link Lock}. * @param name the name of the lock file */ public Lock makeLock(String name) { return lockFactory.makeLock(name); } /**
/** * 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. * @param name name of the lock to be cleared. */ public void clearLock(String name) throws IOException { if (lockFactory != null) { lockFactory.clearLock(name); } }
lockFactory.setLockPrefix("test"); Lock l = verifyLF.makeLock("test.lock");
/** * Set the LockFactory that this Directory instance should * use for its locking implementation. Each * instance of * LockFactory should only be used for one directory (ie, * do not share a single instance across multiple * Directories). * * @param lockFactory instance of {@link LockFactory}. */ public void setLockFactory(LockFactory lockFactory) { this.lockFactory = lockFactory; lockFactory.setLockPrefix(this.getLockID()); }
/** Construct a {@link Lock}. * @param name the name of the lock file */ public Lock makeLock(String name) { return lockFactory.makeLock(name); } /**
/** * 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. * @param name name of the lock to be cleared. */ public void clearLock(String name) throws IOException { if (lockFactory != null) { lockFactory.clearLock(name); } }
@Override public Lock obtainLock(Directory dir, String lockName) throws IOException { return new CheckedLock(lf.obtainLock(dir, lockName)); } }
lockFactory.setLockPrefix("test"); Lock l = verifyLF.makeLock("test.lock");
/** * Set the LockFactory that this Directory instance should * use for its locking implementation. Each * instance of * LockFactory should only be used for one directory (ie, * do not share a single instance across multiple * Directories). * * @param lockFactory instance of {@link LockFactory}. */ public void setLockFactory(LockFactory lockFactory) throws IOException { assert lockFactory != null; this.lockFactory = lockFactory; lockFactory.setLockPrefix(this.getLockID()); }
/** Construct a {@link Lock}. * @param name the name of the lock file */ public Lock makeLock(String name) { return lockFactory.makeLock(name); } /**
public synchronized void clearLock(String lockName) throws IOException { lf.clearLock(lockName); } }
try (final Lock l = verifyLF.obtainLock(lockDir, LOCK_FILE_NAME)) { if (rnd.nextInt(10) == 0) { if (rnd.nextBoolean()) { verifyLF = new VerifyingLockFactory(getNewLockFactory(lockFactoryClassName), in, out); try (final Lock secondLock = verifyLF.obtainLock(lockDir, LOCK_FILE_NAME)) { throw new IOException("Double obtain"); } catch (LockObtainFailedException loe) {
DirectoryLuceneV3(Cache<?, ?> metadataCache, Cache<?, ?> chunksCache, String indexName, LockFactory lf, int chunkSize, SegmentReadLocker readLocker) { this.impl = new DirectoryImplementor(metadataCache, chunksCache, indexName, chunkSize, readLocker); this.indexName = indexName; this.lockFactory = lf; this.lockFactory.setLockPrefix(this.getLockID()); }
@Override public Lock makeLock(String name) { return lockFactory.makeLock(name); }
/** * 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. * @param name name of the lock to be cleared. */ public void clearLock(String name) throws IOException { if (lockFactory != null) { lockFactory.clearLock(name); } }
@Override public Lock obtainLock(String lockName) throws IOException { return lockFactory.obtainLock(this, lockName); }