Package org.apache.lucene.store

Examples of org.apache.lucene.store.NativeFSLockFactory


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


        if (name.equals(".")) {
            dir = baseDir;
        } else {
            dir = new File(baseDir, name);
        }
        return FSDirectory.getDirectory(dir, new NativeFSLockFactory(dir));
    }
View Full Code Here

         spellIndexDirectory = null;
         SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<Object>()
         {
            public Object run() throws Exception
            {
               spellIndexDirectory = FSDirectory.getDirectory(path, new NativeFSLockFactory(path));
               if (IndexReader.indexExists(spellIndexDirectory))
               {
                  lastRefresh = System.currentTimeMillis();
               }
               return null;
View Full Code Here

            }
            else
            {
               dir = new File(baseDir, name);
            }
            return FSDirectory.getDirectory(dir, new NativeFSLockFactory(dir));
         }
      });
   }
View Full Code Here

            if (!dir.mkdirs()) {
                if (!dir.isDirectory()) {
                    throw new IOException("Unable to create directory: '" + dir + "'");
                }
            }
            LockFactory lockFactory = new NativeFSLockFactory(dir);
            if (simpleFS) {
                directory = new SimpleFSDirectory(dir, lockFactory);
            } else {
                directory = FSDirectory.open(dir, lockFactory);
            }
View Full Code Here

    }
    else if ( "native".equals( lockFactoryName ) ) {
      if ( indexDir == null ) {
        throw new SearchException( "To use \"native\" as a LockFactory strategy an indexBase path must be set" );
      }
      return new NativeFSLockFactory( indexDir );
    }
    else if ( "single".equals( lockFactoryName ) ) {
      return new SingleInstanceLockFactory();
    }
    else if ( "none".equals( lockFactoryName ) ) {
View Full Code Here

    protected LockFactory buildLockFactory() throws IOException {
        String fsLock = componentSettings.get("fs_lock", "native");
        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

    @Override public SnapshotLock obtainSnapshotLock() throws Exception {
        if (!snapshotLock) {
            return NO_SNAPSHOT_LOCK;
        }
        AbstractFsBlobContainer fsBlobContainer = (AbstractFsBlobContainer) blobContainer;
        NativeFSLockFactory lockFactory = new NativeFSLockFactory(fsBlobContainer.filePath());

        Lock lock = lockFactory.makeLock("snapshot.lock");
        boolean obtained = lock.obtain();
        if (!obtained) {
            throw new ElasticSearchIllegalStateException("failed to obtain snapshot lock [" + lock + "]");
        }
        return new FsSnapshotLock(lock);
View Full Code Here

            if (!dir.exists()) {
                FileSystemUtils.mkdirs(dir);
            }
            logger.trace("obtaining node lock on {} ...", dir.getAbsolutePath());
            try {
                NativeFSLockFactory lockFactory = new NativeFSLockFactory(dir);
                Lock tmpLock = lockFactory.makeLock("node.lock");
                boolean obtained = tmpLock.obtain();
                if (obtained) {
                    lock = tmpLock;
                    localNodeId = i;
                    break;
View Full Code Here

         *            the associated query handler.
         */
        InternalSpellChecker(SearchIndex handler) throws IOException {
            this.handler = handler;
            String path = handler.getPath() + File.separatorChar + "spellchecker";
            this.spellIndexDirectory = FSDirectory.getDirectory(path, new NativeFSLockFactory(path));
            if (IndexReader.indexExists(spellIndexDirectory)) {
                this.lastRefresh = System.currentTimeMillis();
            }
            this.spellChecker = new JahiaExtendedSpellChecker(spellIndexDirectory);
            refreshSpellChecker();
View Full Code Here

TOP

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

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.