Java 类org.apache.lucene.util.SetOnce 实例源码

项目:elasticsearch_my    文件:Definition.java   
private Struct(final String name, final Class<?> clazz, final org.objectweb.asm.Type type) {
    this.name = name;
    this.clazz = clazz;
    this.type = type;

    constructors = new HashMap<>();
    staticMethods = new HashMap<>();
    methods = new HashMap<>();

    staticMembers = new HashMap<>();
    members = new HashMap<>();

    functionalMethod = new SetOnce<>();
}
项目:search    文件:TestIndexWriter.java   
public void testMergeAllDeleted() throws IOException {
  Directory dir = newDirectory();
  IndexWriterConfig iwc = newIndexWriterConfig(new MockAnalyzer(random()));
  final SetOnce<IndexWriter> iwRef = new SetOnce<>();
  iwc.setInfoStream(new RandomIndexWriter.TestPointInfoStream(iwc.getInfoStream(), new RandomIndexWriter.TestPoint() {
    @Override
    public void apply(String message) {
      if ("startCommitMerge".equals(message)) {
        iwRef.get().setKeepFullyDeletedSegments(false);
      } else if ("startMergeInit".equals(message)) {
        iwRef.get().setKeepFullyDeletedSegments(true);
      }
    }
  }));
  IndexWriter evilWriter = new IndexWriter(dir, iwc);
  iwRef.set(evilWriter);
  for (int i = 0; i < 1000; i++) {
    addDoc(evilWriter);
    if (random().nextInt(17) == 0) {
      evilWriter.commit();
    }
  }
  evilWriter.deleteDocuments(new MatchAllDocsQuery());
  evilWriter.forceMerge(1);
  evilWriter.close();
  dir.close();
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestIndexWriter.java   
public void testMergeAllDeleted() throws IOException {
  Directory dir = newDirectory();
  IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
  final SetOnce<IndexWriter> iwRef = new SetOnce<IndexWriter>();
  iwc.setInfoStream(new RandomIndexWriter.TestPointInfoStream(iwc.getInfoStream(), new RandomIndexWriter.TestPoint() {
    @Override
    public void apply(String message) {
      if ("startCommitMerge".equals(message)) {
        iwRef.get().setKeepFullyDeletedSegments(false);
      } else if ("startMergeInit".equals(message)) {
        iwRef.get().setKeepFullyDeletedSegments(true);
      }
    }
  }));
  IndexWriter evilWriter = new IndexWriter(dir, iwc);
  iwRef.set(evilWriter);
  for (int i = 0; i < 1000; i++) {
    addDoc(evilWriter);
    if (random().nextInt(17) == 0) {
      evilWriter.commit();
    }
  }
  evilWriter.deleteDocuments(new MatchAllDocsQuery());
  evilWriter.forceMerge(1);
  evilWriter.close();
  dir.close();
}
项目:elasticsearch_my    文件:DatabaseReaderLazyLoader.java   
DatabaseReaderLazyLoader(String databaseFileName, CheckedSupplier<DatabaseReader, IOException> loader) {
    this.databaseFileName = databaseFileName;
    this.loader = loader;
    this.databaseReader = new SetOnce<>();
}
项目:read-open-source-code    文件:MergePolicy.java   
/**
 * Creates a new merge policy instance with default settings for noCFSRatio
 * and maxCFSSegmentSize. This ctor should be used by subclasses using different
 * defaults than the {@link MergePolicy}
 */
protected MergePolicy(double defaultNoCFSRatio, long defaultMaxCFSSegmentSize) {
  writer = new SetOnce<IndexWriter>();
  this.noCFSRatio = defaultNoCFSRatio;
  this.maxCFSSegmentSize = defaultMaxCFSSegmentSize;
}
项目:read-open-source-code    文件:MergePolicy.java   
/**
 * Creates a new merge policy instance with default settings for noCFSRatio
 * and maxCFSSegmentSize. This ctor should be used by subclasses using different
 * defaults than the {@link MergePolicy}
 */
protected MergePolicy(double defaultNoCFSRatio, long defaultMaxCFSSegmentSize) {
  writer = new SetOnce<IndexWriter>();
  this.noCFSRatio = defaultNoCFSRatio;
  this.maxCFSSegmentSize = defaultMaxCFSSegmentSize;
}
项目:Maskana-Gestor-de-Conocimiento    文件:MergePolicy.java   
/**
 * Creates a new merge policy instance with default settings for noCFSRatio
 * and maxCFSSegmentSize. This ctor should be used by subclasses using different
 * defaults than the {@link MergePolicy}
 */
protected MergePolicy(double defaultNoCFSRatio, long defaultMaxCFSSegmentSize) {
  writer = new SetOnce<IndexWriter>();
  this.noCFSRatio = defaultNoCFSRatio;
  this.maxCFSSegmentSize = defaultMaxCFSSegmentSize;
}
项目:NYBC    文件:MergePolicy.java   
/**
 * Creates a new merge policy instance. Note that if you intend to use it
 * without passing it to {@link IndexWriter}, you should call
 * {@link #setIndexWriter(IndexWriter)}.
 */
public MergePolicy() {
  writer = new SetOnce<IndexWriter>();
}