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

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

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

Lock.isLocked介绍

[英]Returns true if the resource is currently locked. Note that one must still call #obtain() before using the resource.
[中]如果资源当前已锁定,则返回true。请注意,在使用资源之前,仍然必须调用#get()。

代码示例

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

  1. @Override
  2. public synchronized boolean isLocked() throws IOException {
  3. return lock.isLocked();
  4. }

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

  1. public boolean isLocked() {
  2. return lock.isLocked();
  3. }
  4. }

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

  1. public synchronized boolean isLocked() {
  2. return lock.isLocked();
  3. }

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

  1. public synchronized boolean isLocked() {
  2. return lock.isLocked();
  3. }

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

  1. /**
  2. * Returns <code>true</code> iff the index in the named directory is
  3. * currently locked.
  4. * @param directory the directory to check for a lock
  5. * @throws IOException if there is a low-level IO error
  6. * @deprecated Please use {@link IndexWriter#isLocked(Directory)} instead
  7. */
  8. public static boolean isLocked(Directory directory) throws IOException {
  9. return
  10. directory.makeLock(IndexWriter.WRITE_LOCK_NAME).isLocked();
  11. }

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

  1. /**
  2. * Returns <code>true</code> iff the index in the named directory is
  3. * currently locked.
  4. * @param directory the directory to check for a lock
  5. * @throws IOException if there is a low-level IO error
  6. */
  7. public static boolean isLocked(Directory directory) throws IOException {
  8. return directory.makeLock(WRITE_LOCK_NAME).isLocked();
  9. }

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

  1. /**
  2. * Returns <code>true</code> iff the index in the named directory is
  3. * currently locked.
  4. * @param directory the directory to check for a lock
  5. * @throws IOException if there is a low-level IO error
  6. * @deprecated Please use {@link IndexWriter#isLocked(Directory)} instead
  7. */
  8. public static boolean isLocked(Directory directory) throws IOException {
  9. return
  10. directory.makeLock(IndexWriter.WRITE_LOCK_NAME).isLocked();
  11. }

代码示例来源:origin: altamiracorp/blur

  1. @Override
  2. protected void doAfterFlush() throws IOException {
  3. super.doAfterFlush();
  4. if (!internalLock.isLocked()) {
  5. throw new IOException("Lock [" + internalLock +"] no longer has write lock.");
  6. }
  7. }

代码示例来源:origin: altamiracorp/blur

  1. @Override
  2. protected void doBeforeFlush() throws IOException {
  3. super.doBeforeFlush();
  4. if (!internalLock.isLocked()) {
  5. throw new IOException("Lock [" + internalLock +"] no longer has write lock.");
  6. }
  7. }

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

  1. /**
  2. * Returns <code>true</code> iff the index in the named directory is
  3. * currently locked.
  4. * @param directory the directory to check for a lock
  5. * @throws IOException if there is a low-level IO error
  6. */
  7. public static boolean isLocked(Directory directory) throws IOException {
  8. return directory.makeLock(WRITE_LOCK_NAME).isLocked();
  9. }

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

  1. /**
  2. * Returns <code>true</code> iff the index in the named directory is
  3. * currently locked.
  4. * @param directory the directory to check for a lock
  5. * @throws IOException if there is a problem with accessing the index
  6. */
  7. public static boolean isLocked(Directory directory) throws IOException {
  8. return
  9. directory.makeLock(IndexWriter.WRITE_LOCK_NAME).isLocked() ||
  10. directory.makeLock(IndexWriter.COMMIT_LOCK_NAME).isLocked();
  11. }

代码示例来源:origin: com.atlassian.jira/jira-core

  1. public Collection<String> getLocks(final String path) throws IOException
  2. {
  3. final Collection<String> locks = Lists.newArrayList();
  4. Directory dir = null;
  5. try
  6. {
  7. dir = getDirectory(new File(path));
  8. // Check write lock
  9. final org.apache.lucene.store.Lock lock = dir.makeLock(IndexWriter.WRITE_LOCK_NAME);
  10. if (lock.isLocked())
  11. {
  12. locks.add(getLockFilepath(lock));
  13. }
  14. }
  15. finally
  16. {
  17. if (dir != null)
  18. {
  19. dir.close();
  20. }
  21. }
  22. return locks;
  23. }

代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core

  1. directoryName = "snapshot." + fmt.format(new Date());
  2. lock = lockFactory.makeLock(directoryName + ".lock");
  3. if (lock.isLocked()) return;
  4. snapShotDir = new File(snapDir, directoryName);
  5. if (!snapShotDir.mkdir()) {

相关文章