Package org.apache.lucene.store

Examples of org.apache.lucene.store.LockFactory


   * @param properties the configuration properties
   * @return the created {@code FSDirectory} instance
   * @throws java.io.IOException if an error
   */
  public static FSDirectory createFSIndex(File indexDir, Properties properties, ServiceManager serviceManager) throws IOException {
    LockFactory lockFactory = createLockFactory( indexDir, properties, serviceManager );
    FSDirectoryType fsDirectoryType = FSDirectoryType.getType( properties );
    FSDirectory fsDirectory = fsDirectoryType.getDirectory( indexDir, null );

    // must use the setter (instead of using the constructor) to set the lockFactory, or Lucene will
    // throw an exception if it's different than a previous setting.
View Full Code Here


   * @return the created {@code FSDirectory} instance
   *
   * @throws IOException if an error
   */
  public static FSDirectory createFSIndex(File indexDir, Properties properties) throws IOException {
    LockFactory lockFactory = createLockFactory( indexDir, properties );
    FSDirectoryType fsDirectoryType = FSDirectoryType.getType( properties );
    FSDirectory fsDirectory = fsDirectoryType.getDirectory( indexDir, null );

    // must use the setter (instead of using the constructor) to set the lockFactory, or Lucene will
    // throw an exception if it's different than a previous setting.
View Full Code Here

  private void verifyIndexIsLocked(boolean isLocked, Class type) throws IOException {
    SearchFactoryImplementor searchFactory = (SearchFactoryImplementor) builder.getSearchFactory();
    DirectoryBasedIndexManager indexManager = (DirectoryBasedIndexManager) searchFactory.getIndexBinding( type ).getIndexManagers()[0];
    Directory directory = indexManager.getDirectoryProvider().getDirectory();
    LockFactory lockFactory = directory.getLockFactory();
    Lock writeLock = lockFactory.makeLock( "write.lock" );
    Assert.assertEquals( isLocked, writeLock.isLocked() );
  }
View Full Code Here

      SearchFactoryImplementor searchFactory = (SearchFactoryImplementor) ftsb.getSearchFactory();
      EntityIndexBinding indexBindingForEntity = searchFactory.getIndexBinding( SnowStorm.class );
      DirectoryBasedIndexManager indexManager = (DirectoryBasedIndexManager) indexBindingForEntity.getIndexManagers()[0];
      DirectoryProvider directoryProvider = indexManager.getDirectoryProvider();
      Directory directory = directoryProvider.getDirectory();
      LockFactory lockFactory = directory.getLockFactory();
      assertEquals( expectedType, lockFactory.getClass() );
    }
    finally {
      builder.close();
    }
    assertEquals( null, CustomLockFactoryProvider.optionValue );
View Full Code Here

   * @param indexDir The directory where to write a new index
   * @return the created FSDirectory
   * @throws IOException
   */
  public static FSDirectory createFSIndex(File indexDir, Properties dirConfiguration) throws IOException {
    LockFactory lockFactory = createLockFactory(indexDir, dirConfiguration);
    FSDirectory fsDirectory = FSDirectory.open( indexDir, null );
    // must use the setter (instead of using the constructor) to set the lockFactory, or Lucene will
    // throw an exception if it's different than a previous setting.
    fsDirectory.setLockFactory( lockFactory );
    if ( ! IndexReader.indexExists( fsDirectory ) ) {
View Full Code Here

   * @param properties the configuration properties
   * @return the created {@code FSDirectory} instance
   * @throws java.io.IOException if an error
   */
  public static FSDirectory createFSIndex(File indexDir, Properties properties) throws IOException {
    LockFactory lockFactory = createLockFactory( indexDir, properties );
    FSDirectoryType fsDirectoryType = FSDirectoryType.getType( properties );
    FSDirectory fsDirectory = fsDirectoryType.getDirectory( indexDir, null );

    // must use the setter (instead of using the constructor) to set the lockFactory, or Lucene will
    // throw an exception if it's different than a previous setting.
View Full Code Here

   * @param properties the configuration properties
   * @return the created {@code FSDirectory} instance
   * @throws java.io.IOException if an error
   */
  public static FSDirectory createFSIndex(File indexDir, Properties properties) throws IOException {
    LockFactory lockFactory = createLockFactory( indexDir, properties );
    FSDirectoryType fsDirectoryType = FSDirectoryType.getType( properties );
    FSDirectory fsDirectory = fsDirectoryType.getDirectory( indexDir, null );

    // must use the setter (instead of using the constructor) to set the lockFactory, or Lucene will
    // throw an exception if it's different than a previous setting.
View Full Code Here

   * @param indexDir The directory where to write a new index
   * @return the created FSDirectory
   * @throws IOException
   */
  public static FSDirectory createFSIndex(File indexDir, Properties dirConfiguration) throws IOException {
    LockFactory lockFactory = createLockFactory(indexDir, dirConfiguration);
    FSDirectory fsDirectory = FSDirectory.getDirectory( indexDir, null );
    // must use the setter (instead of using the constructor) to set the lockFactory, or Lucene will
    // throw an exception if it's different than a previous setting.
    fsDirectory.setLockFactory( lockFactory );
    if ( ! IndexReader.indexExists( fsDirectory ) ) {
View Full Code Here

               if (!dir.mkdirs())
               {
                  throw new IOException("Cannot create directory: " + dir);
               }
            }
            LockFactory lockFactory =
               (LOCK_FACTORY_CLASS == null) ? new NativeFSLockFactory() : (LockFactory)LOCK_FACTORY_CLASS.newInstance();

            if (FS_DIRECTORY_CLASS == null)
            {
               return FSDirectory.open(dir, lockFactory);
View Full Code Here

   /**
    * This is returning as soon as the lock is available, or after 10 seconds.
    * @return true if the lock is free at the time of returning.
    */
   private boolean waitForAvailabilityInternal() {
      final LockFactory lockFactory = getLockFactory();
      final Lock lock = lockFactory.makeLock(IndexWriter.WRITE_LOCK_NAME);
      try {
         if (! lock.isLocked()) {
            return true;
         }
         else {
View Full Code Here

TOP

Related Classes of org.apache.lucene.store.LockFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.