There are 2 code examples for org.apache.lucene.store.LockObtainFailedException.

The API names are highlighted below. You can use suckoo button to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.

Project Name: hnlpengine-luceneanalyzer Package: rha

Source Code: Registry.java (Click to view .java file)

Method Code:
vote
like

public static IndexWriter getIndexWriter(String key){
  IndexWriter res=(IndexWriter)IndexRegistry.get(key);
  if (res == null) {
    StandardAnalyzer analyzer=new StandardAnalyzer();
    RAMDirectory directory=new RAMDirectory();
    IndexWriter writer;
    try {
      res=new IndexWriter(directory,analyzer,true,new MaxFieldLength(500));
    }
 catch (    CorruptIndexException e) {
      e.printStackTrace();
    }
catch (    LockObtainFailedException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
    IndexRegistry.put("key",res);
  }
  return res;
}
 

Project Name: rssowl.core Package: org.rssowl.core.internal.persist.search

Source Code: ModelSearchImpl.java (Click to view .java file)

Method Code:
vote
like

private void startup(boolean clearIndex) throws PersistenceException {
  try {
    if (fDirectory == null) {
      String path=Activator.getDefault().getStateLocation().toOSString();
      if (clearIndex) {
        File directory=new File(path);
        File[] indexFiles=directory.listFiles(new IndexFileNameFilter());
        try {
          for (          File file : indexFiles) {
            file.delete();
          }
        }
 catch (        Exception e) {
          Activator.getDefault().logError(e.getMessage(),e);
        }
      }
      LockFactory lockFactory=new NativeFSLockFactory(path);
      fDirectory=FSDirectory.getDirectory(path,lockFactory);
    }
    if (fIndexer == null)     fIndexer=new Indexer(this,fDirectory);
    fIndexer.initIfNecessary(clearIndex);
synchronized (this) {
      if (fSearcher == null)       fSearcher=createIndexSearcher();
    }
  }
 catch (  LockObtainFailedException e) {
    throw new ProfileLockedException(e.getMessage(),e);
  }
catch (  IOException e) {
    throw new PersistenceException(e.getMessage(),e);
  }
}