Examples of ThreadState


Examples of org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState

  protected void assertActiveBytesAfter(DocumentsWriterFlushControl flushControl) {
    Iterator<ThreadState> allActiveThreads = flushControl.allActiveThreadStates();
    long bytesUsed = 0;
    while (allActiveThreads.hasNext()) {
      ThreadState next = allActiveThreads.next();
      if (next.dwpt != null) {
        bytesUsed += next.dwpt.bytesUsed();
      }
    }
    assertEquals(bytesUsed, flushControl.activeBytes());
View Full Code Here

Examples of org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState

  static void findPending(DocumentsWriterFlushControl flushControl,
      ArrayList<ThreadState> pending, ArrayList<ThreadState> notPending) {
    Iterator<ThreadState> allActiveThreads = flushControl.allActiveThreadStates();
    while (allActiveThreads.hasNext()) {
      ThreadState next = allActiveThreads.next();
      if (next.flushPending) {
        pending.add(next);
      } else {
        notPending.add(next);
      }
View Full Code Here

Examples of org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState

    public void onDelete(DocumentsWriterFlushControl control, ThreadState state) {
      final ArrayList<ThreadState> pending = new ArrayList<DocumentsWriterPerThreadPool.ThreadState>();
      final ArrayList<ThreadState> notPending = new ArrayList<DocumentsWriterPerThreadPool.ThreadState>();
      findPending(control, pending, notPending);
      final boolean flushCurrent = state.flushPending;
      final ThreadState toFlush;
      if (state.flushPending) {
        toFlush = state;
      } else if (flushOnDeleteTerms()
          && state.dwpt.pendingUpdates.numTermDeletes.get() >= indexWriterConfig
              .getMaxBufferedDeleteTerms()) {
View Full Code Here

Examples of org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState

      final ArrayList<ThreadState> pending = new ArrayList<DocumentsWriterPerThreadPool.ThreadState>();
      final ArrayList<ThreadState> notPending = new ArrayList<DocumentsWriterPerThreadPool.ThreadState>();
      findPending(control, pending, notPending);
      final boolean flushCurrent = state.flushPending;
      long activeBytes = control.activeBytes();
      final ThreadState toFlush;
      if (state.flushPending) {
        toFlush = state;
      } else if (flushOnDocCount()
          && state.dwpt.getNumDocsInRAM() >= indexWriterConfig
              .getMaxBufferedDocs()) {
View Full Code Here

Examples of org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState

      if (infoStream.isEnabled("DW")) {
        infoStream.message("DW", "abort");
      }
      final int limit = perThreadPool.getActiveThreadState();
      for (int i = 0; i < limit; i++) {
        final ThreadState perThread = perThreadPool.getThreadState(i);
        perThread.lock();
        try {
          abortThreadState(perThread, newFilesSet);
        } finally {
          perThread.unlock();
        }
      }
      flushControl.abortPendingFlushes(newFilesSet);
      putEvent(new DeleteNewFilesEvent(newFilesSet));
      flushControl.waitForFlush();
View Full Code Here

Examples of org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState

    try {
      deleteQueue.clear();
      final int limit = perThreadPool.getMaxThreadStates();
      final Set<String> newFilesSet = new HashSet<String>();
      for (int i = 0; i < limit; i++) {
        final ThreadState perThread = perThreadPool.getThreadState(i);
        perThread.lock();
        abortThreadState(perThread, newFilesSet);
      }
      deleteQueue.clear();
      flushControl.abortPendingFlushes(newFilesSet);
      putEvent(new DeleteNewFilesEvent(newFilesSet));
View Full Code Here

Examples of org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState

      infoStream.message("DW", "unlockAll");
    }
    final int limit = perThreadPool.getMaxThreadStates();
    for (int i = 0; i < limit; i++) {
      try {
        final ThreadState perThread = perThreadPool.getThreadState(i);
        if (perThread.isHeldByCurrentThread()) {
          perThread.unlock();
        }
      } catch(Throwable e) {
        if (infoStream.isEnabled("DW")) {
          infoStream.message("DW", "unlockAll: could not unlock state: " + i + " msg:" + e.getMessage());
        }
View Full Code Here

Examples of org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState

  boolean updateDocuments(final Iterable<? extends Iterable<? extends IndexableField>> docs, final Analyzer analyzer,
                          final Term delTerm) throws IOException {
    boolean hasEvents = preUpdate();

    final ThreadState perThread = flushControl.obtainAndLock();
    final DocumentsWriterPerThread flushingDWPT;
   
    try {
      if (!perThread.isActive()) {
        ensureOpen();
        assert false: "perThread is not active but we are still open";
      }
      ensureInitialized(perThread);
      assert perThread.isInitialized();
      final DocumentsWriterPerThread dwpt = perThread.dwpt;
      final int dwptNumDocs = dwpt.getNumDocsInRAM();
      try {
        final int docCount = dwpt.updateDocuments(docs, analyzer, delTerm);
        numDocsInRAM.addAndGet(docCount);
      } finally {
        if (dwpt.checkAndResetHasAborted()) {
          if (!dwpt.pendingFilesToDelete().isEmpty()) {
            putEvent(new DeleteNewFilesEvent(dwpt.pendingFilesToDelete()));
          }
          subtractFlushedNumDocs(dwptNumDocs);
          flushControl.doOnAbort(perThread);
        }
      }
      final boolean isUpdate = delTerm != null;
      flushingDWPT = flushControl.doAfterDocument(perThread, isUpdate);
    } finally {
      perThread.unlock();
    }

    return postUpdate(flushingDWPT, hasEvents);
  }
View Full Code Here

Examples of org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState

  boolean updateDocument(final Iterable<? extends IndexableField> doc, final Analyzer analyzer,
      final Term delTerm) throws IOException {

    boolean hasEvents = preUpdate();

    final ThreadState perThread = flushControl.obtainAndLock();

    final DocumentsWriterPerThread flushingDWPT;
    try {
      if (!perThread.isActive()) {
        ensureOpen();
        assert false: "perThread is not active but we are still open";
      }
      ensureInitialized(perThread);
      assert perThread.isInitialized();
      final DocumentsWriterPerThread dwpt = perThread.dwpt;
      final int dwptNumDocs = dwpt.getNumDocsInRAM();
      try {
        dwpt.updateDocument(doc, analyzer, delTerm);
        numDocsInRAM.incrementAndGet();
      } finally {
        if (dwpt.checkAndResetHasAborted()) {
          if (!dwpt.pendingFilesToDelete().isEmpty()) {
            putEvent(new DeleteNewFilesEvent(dwpt.pendingFilesToDelete()));
          }
          subtractFlushedNumDocs(dwptNumDocs);
          flushControl.doOnAbort(perThread);
        }
      }
      final boolean isUpdate = delTerm != null;
      flushingDWPT = flushControl.doAfterDocument(perThread, isUpdate);
    } finally {
      perThread.unlock();
    }

    return postUpdate(flushingDWPT, hasEvents);
  }
View Full Code Here

Examples of org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState

      if (infoStream.isEnabled("DW")) {
        infoStream.message("DW", "abort");
      }
      final int limit = perThreadPool.getActiveThreadState();
      for (int i = 0; i < limit; i++) {
        final ThreadState perThread = perThreadPool.getThreadState(i);
        perThread.lock();
        try {
          abortThreadState(perThread, newFilesSet);
        } finally {
          perThread.unlock();
        }
      }
      flushControl.abortPendingFlushes(newFilesSet);
      putEvent(new DeleteNewFilesEvent(newFilesSet));
      flushControl.waitForFlush();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.