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<>(); }
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(); }
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(); }
DatabaseReaderLazyLoader(String databaseFileName, CheckedSupplier<DatabaseReader, IOException> loader) { this.databaseFileName = databaseFileName; this.loader = loader; this.databaseReader = new SetOnce<>(); }
/** * 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; }
/** * 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>(); }