Package org.apache.lucene.store

Examples of org.apache.lucene.store.SimpleFSLockFactory


  public void testWhetherDeleteAllDeletesWriteLock() throws Exception {
    Directory d = newFSDirectory(_TestUtil.getTempDir("TestIndexWriter.testWhetherDeleteAllDeletesWriteLock"));
    // Must use SimpleFSLockFactory... NativeFSLockFactory
    // somehow "knows" a lock is held against write.lock
    // even if you remove that file:
    d.setLockFactory(new SimpleFSLockFactory());
    RandomIndexWriter w1 = new RandomIndexWriter(random(), d);
    w1.deleteAll();
    try {
      new RandomIndexWriter(random(), d, newIndexWriterConfig(TEST_VERSION_CURRENT, null).setWriteLockTimeout(100));
      fail("should not be able to create another writer");
View Full Code Here


    if ( "simple".equals( lockFactoryName ) ) {
      if ( indexDir==null ) {
        throw new SearchException( "To use \"simple\" as a LockFactory strategy an indexBase path must be set");
      }
      try {
        return new SimpleFSLockFactory( indexDir );
      } catch (IOException e) {
        throw new SearchException( "Could not initialize SimpleFSLockFactory", e);
      }
    }
    else if ( "native".equals( lockFactoryName ) ) {
View Full Code Here

    if ( "simple".equals( lockFactoryName ) ) {
      if ( indexDir == null ) {
        throw new SearchException( "To use \"simple\" as a LockFactory strategy an indexBase path must be set" );
      }
      try {
        return new SimpleFSLockFactory( indexDir );
      }
      catch (IOException e) {
        throw new SearchException( "Could not initialize SimpleFSLockFactory", e );
      }
    }
View Full Code Here

    if ( "simple".equals( lockFactoryName ) ) {
      if ( indexDir == null ) {
        throw new SearchException( "To use \"simple\" as a LockFactory strategy an indexBase path must be set" );
      }
      try {
        return new SimpleFSLockFactory( indexDir );
      }
      catch ( IOException e ) {
        throw new SearchException( "Could not initialize SimpleFSLockFactory", e );
      }
    }
View Full Code Here

    if ( "simple".equals( lockFactoryName ) ) {
      if ( indexDir == null ) {
        throw new SearchException( "To use \"simple\" as a LockFactory strategy an indexBase path must be set" );
      }
      try {
        return new SimpleFSLockFactory( indexDir );
      }
      catch ( IOException e ) {
        throw new SearchException( "Could not initialize SimpleFSLockFactory", e );
      }
    }
View Full Code Here

    if ( "simple".equals( lockFactoryName ) ) {
      if ( indexDir == null ) {
        throw new SearchException( "To use \"simple\" as a LockFactory strategy an indexBase path must be set" );
      }
      try {
        return new SimpleFSLockFactory( indexDir );
      }
      catch ( IOException e ) {
        throw new SearchException( "Could not initialize SimpleFSLockFactory", e );
      }
    }
View Full Code Here

  public void testWhetherDeleteAllDeletesWriteLock() throws Exception {
    Directory d = newFSDirectory(_TestUtil.getTempDir("TestIndexWriter.testWhetherDeleteAllDeletesWriteLock"));
    // Must use SimpleFSLockFactory... NativeFSLockFactory
    // somehow "knows" a lock is held against write.lock
    // even if you remove that file:
    d.setLockFactory(new SimpleFSLockFactory());
    RandomIndexWriter w1 = new RandomIndexWriter(random(), d);
    w1.deleteAll();
    try {
      new RandomIndexWriter(random(), d, newIndexWriterConfig(TEST_VERSION_CURRENT, null).setWriteLockTimeout(100));
      fail("should not be able to create another writer");
View Full Code Here

    String lockFactoryName = dirConfiguration.getProperty( LOCKING_STRATEGY_PROP_NAME, defaultStrategy );
    if ( "simple".equals( lockFactoryName ) ) {
      if ( indexDir == null ) {
        throw new SearchException( "To use \"simple\" as a LockFactory strategy an indexBase path must be set" );
      }
      return new SimpleFSLockFactory( indexDir );
    }
    else if ( "native".equals( lockFactoryName ) ) {
      if ( indexDir == null ) {
        throw new SearchException( "To use \"native\" as a LockFactory strategy an indexBase path must be set" );
      }
View Full Code Here

      File base = new File(core.getCoreDescriptor().getInstanceDir());
      snapDir = org.apache.solr.common.util.FileUtils.resolvePath(base, location).getAbsolutePath();
      File dir = new File(snapDir);
      if (!dir.exists())  dir.mkdirs();
    }
    lockFactory = new SimpleFSLockFactory(snapDir);
  }
View Full Code Here

        LockFactory lockFactory = new NoLockFactory();
        if (fsLock.equals("native")) {
            // TODO LUCENE MONITOR: this is not needed in next Lucene version
            lockFactory = new NativeFSLockFactory();
        } else if (fsLock.equals("simple")) {
            lockFactory = new SimpleFSLockFactory();
        }
        return lockFactory;
    }
View Full Code Here

TOP

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

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.