/** Release the write lock, if needed. */ protected void finalize() throws IOException { if (writeLock != null) { writeLock.release(); // release write lock writeLock = null; } }
@Override public void release() throws IOException { lock.release(); }
/** Release the write lock, if needed. */ protected final void finalize() throws IOException { if (writeLock != null) { writeLock.release(); // release write lock writeLock = null; } }
/** Release the write lock, if needed. */ protected void finalize() throws Throwable { try { if (writeLock != null) { writeLock.release(); // release write lock writeLock = null; } } finally { super.finalize(); } }
/** Release the write lock, if needed. */ protected void finalize() throws Throwable { try { if (writeLock != null) { writeLock.release(); // release write lock writeLock = null; } } finally { super.finalize(); } }
/** Release the write lock, if needed. */ protected void finalize() throws Throwable { try { if (writeLock != null) { writeLock.release(); // release write lock writeLock = null; } } finally { super.finalize(); } }
/** Release the write lock, if needed. */ protected void finalize() throws Throwable { try { if (writeLock != null) { writeLock.release(); // release write lock writeLock = null; } } finally { super.finalize(); } }
private void clearLocksIfNeeded() { if (!maintainOrder) { return; } for (Map.Entry<String, Lock> entry : orderLocks.entrySet()) { try { entry.getValue().release(); } catch (IOException e) { logger.warn("Failed to release lock for sub index [" + entry.getKey() + "]", e); } } orderLocks.clear(); }
/** * Forcibly unlocks the index in the named directory. * <P> * Caution: this should only be used by failure recovery code, * when it is known that no other process nor thread is in fact * currently accessing this index. * @deprecated Please use {@link IndexWriter#unlock(Directory)} instead */ public static void unlock(Directory directory) throws IOException { directory.makeLock(IndexWriter.WRITE_LOCK_NAME).release(); }
/** * Forcibly unlocks the index in the named directory. * <P> * Caution: this should only be used by failure recovery code, * when it is known that no other process nor thread is in fact * currently accessing this index. */ public static void unlock(Directory directory) throws IOException { directory.makeLock(IndexWriter.WRITE_LOCK_NAME).release(); directory.makeLock(IndexWriter.COMMIT_LOCK_NAME).release(); } }
/** * Forcibly unlocks the index in the named directory. * <P> * Caution: this should only be used by failure recovery code, * when it is known that no other process nor thread is in fact * currently accessing this index. */ public static void unlock(Directory directory) throws IOException { directory.makeLock(IndexWriter.WRITE_LOCK_NAME).release(); }
/** * Forcibly unlocks the index in the named directory. * <P> * Caution: this should only be used by failure recovery code, * when it is known that no other process nor thread is in fact * currently accessing this index. */ public static void unlock(Directory directory) throws IOException { directory.makeLock(IndexWriter.WRITE_LOCK_NAME).release(); }
/** * Forcibly unlocks the index in the named directory. * <P> * Caution: this should only be used by failure recovery code, * when it is known that no other process nor thread is in fact * currently accessing this index. * @deprecated Please use {@link IndexWriter#unlock(Directory)} instead */ public static void unlock(Directory directory) throws IOException { directory.makeLock(IndexWriter.WRITE_LOCK_NAME).release(); }
private void acquireTestLock() throws IOException { String randomLockName = "lucene-" + Long.toString(new Random().nextInt(), Character.MAX_RADIX) + "-test.lock"; Lock l = makeLock(randomLockName); try { l.obtain(); } catch (IOException e) { IOException e2 = new IOException("Failed to acquire random test lock; please verify filesystem for lock directory '" + lockDir + "' supports locking"); e2.initCause(e); throw e2; } l.release(); }
private void acquireTestLock() throws IOException { String randomLockName = "lucene-" + Long.toString(new Random().nextInt(), Character.MAX_RADIX) + "-test.lock"; Lock l = makeLock(randomLockName); try { l.obtain(); } catch (IOException e) { IOException e2 = new IOException("Failed to acquire random test lock; please verify filesystem for lock directory '" + lockDir + "' supports locking"); e2.initCause(e); throw e2; } l.release(); }
public synchronized void release() throws IOException { if (isLocked()) { verify((byte) 0); lock.release(); } } }
@Override public synchronized void release() throws IOException { if (isLocked()) { verify((byte) 0); lock.release(); } } }
public synchronized void release() throws IOException { if (isLocked()) { verify((byte) 0); lock.release(); } } }
/** Calls {@link #doBody} while <i>lock</i> is obtained. Blocks if lock * cannot be obtained immediately. Retries to obtain lock once per second * until it is obtained, or until it has tried ten times. Lock is released when * {@link #doBody} exits. */ public Object run() throws IOException { boolean locked = false; try { locked = lock.obtain(lockWaitTimeout); return doBody(); } finally { if (locked) lock.release(); } } }
/** Flushes all changes to an index and closes all associated files. */ public synchronized void close() throws IOException { flushRamSegments(); ramDirectory.close(); writeLock.release(); // release write lock writeLock = null; if(closeDir) directory.close(); }