org.apache.lucene.store.Lock.release()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.apache.lucene.store.Lock.release()方法的一些代码示例,展示了Lock.release()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lock.release()方法的具体详情如下:
包路径:org.apache.lucene.store.Lock
类名称:Lock
方法名:release

Lock.release介绍

[英]Releases exclusive access.
[中]释放独占访问权限。

代码示例

代码示例来源:origin: lucene/lucene

/** Release the write lock, if needed. */
protected void finalize() throws IOException {
 if (writeLock != null) {
  writeLock.release();                        // release write lock
  writeLock = null;
 }
}

代码示例来源:origin: org.compass-project/compass

@Override
public void release() throws IOException {
  lock.release();
}

代码示例来源:origin: lucene/lucene

/** Release the write lock, if needed. */
protected final void finalize() throws IOException {
 if (writeLock != null) {
  writeLock.release();                        // release write lock
  writeLock = null;
 }
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/** 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();
 }
}

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

/** 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();
 }
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/** 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();
 }
}

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

/** 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();
 }
}

代码示例来源:origin: org.compass-project/compass

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();
}

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

/**
 * 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();
}

代码示例来源:origin: lucene/lucene

/**
  * 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();
 }
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/**
 * 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();
}

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

/**
 * 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();
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/**
 * 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();
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

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();
}

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

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();
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

public synchronized void release() throws IOException {
  if (isLocked()) {
   verify((byte) 0);
   lock.release();
  }
 }
}

代码示例来源:origin: gncloud/fastcatsearch

@Override
 public synchronized void release() throws IOException {
  if (isLocked()) {
   verify((byte) 0);
   lock.release();
  }
 }
}

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

public synchronized void release() throws IOException {
  if (isLocked()) {
   verify((byte) 0);
   lock.release();
  }
 }
}

代码示例来源:origin: lucene/lucene

/** 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();
  }
 }
}

代码示例来源:origin: lucene/lucene

/** 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();
}

相关文章

微信公众号

最新文章

更多