Package org.apache.lucene.store.profile

Examples of org.apache.lucene.store.profile.Profile


    return "Index" + index;
  }

  public static IndexSearcher getSearcher(Integer index) throws IOException {

    Profile prof = new Profile("getIndexSearcher").start();

    IndexSearcher result = null;

    synchronized (searchers) {

      if (!searchers.containsKey(index)) {
        Directory directory = getDirectory(index);
        result = createSearcher(directory, index);
        searchers.put(index, result);
      } else {
        result = searchers.get(index);
      }

    }

    prof.end().log();

    return result;

  }
View Full Code Here


  }

  public static IndexWriter getWriter(Integer index) throws IOException {

    Profile prof = new Profile("getIndexWriter").start();

    IndexWriter result = null;

    synchronized (writers) {

      if (!writers.containsKey(index)) {
        Directory directory = getDirectory(index);
        result = createWriter(directory, index);
        writers.put(index, result);
      } else {
        result = writers.get(index);
      }

    }

    prof.end().log();

    return result;

  }
View Full Code Here

  }

  public static void resetSearcher(Integer index) {

    Profile prof = new Profile("resetSearcher").start();

    try {

      synchronized (searchers) {

        if (searchers.containsKey(index)) {

          IndexSearcher searcher = searchers.remove(index);

          if (searcher != null) {
            try {
              searcher.close();
            } catch (Exception e) {
              throw new RuntimeException(e);
            }

          }

        }

      }

    } catch (Exception e) {
      throw new RuntimeException(e);
    }

    prof.end().log();

  }
View Full Code Here

  }

  public static void resetWriter(Integer index) {

    Profile prof = new Profile("resetWriter").start();

    synchronized (writers) {

      if (writers.containsKey(index)) {

        IndexWriter writer = writers.remove(index);

        if (writer != null) {
          try {
            writer.close();
          } catch (Exception e) {
            throw new RuntimeException(e);
          }

        }

      }

    }

    prof.end().log();

  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.store.profile.Profile

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.