Search in sources :

Example 16 with ThreadInterruptedException

use of org.apache.lucene.util.ThreadInterruptedException in project lucene-solr by apache.

the class ReplicationClient method stopUpdateThread.

/**
   * Stop the update thread. If the update thread is not running, silently does
   * nothing. This method returns after the update thread has stopped.
   */
public synchronized void stopUpdateThread() {
    if (updateThread != null) {
        // this will trigger the thread to terminate if it awaits the lock.
        // otherwise, if it's in the middle of replication, we wait for it to
        // stop.
        updateThread.stop.countDown();
        try {
            updateThread.join();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new ThreadInterruptedException(e);
        }
        updateThread = null;
    }
}
Also used : ThreadInterruptedException(org.apache.lucene.util.ThreadInterruptedException) ThreadInterruptedException(org.apache.lucene.util.ThreadInterruptedException)

Example 17 with ThreadInterruptedException

use of org.apache.lucene.util.ThreadInterruptedException in project lucene-solr by apache.

the class ControlledRealTimeReopenThread method close.

@Override
public synchronized void close() {
    //System.out.println("NRT: set finish");
    finish = true;
    // So thread wakes up and notices it should finish:
    reopenLock.lock();
    try {
        reopenCond.signal();
    } finally {
        reopenLock.unlock();
    }
    try {
        join();
    } catch (InterruptedException ie) {
        throw new ThreadInterruptedException(ie);
    }
    // Max it out so any waiting search threads will return:
    searchingGen = Long.MAX_VALUE;
    notifyAll();
}
Also used : ThreadInterruptedException(org.apache.lucene.util.ThreadInterruptedException) ThreadInterruptedException(org.apache.lucene.util.ThreadInterruptedException)

Aggregations

ThreadInterruptedException (org.apache.lucene.util.ThreadInterruptedException)17 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 ExecutionException (java.util.concurrent.ExecutionException)2 Future (java.util.concurrent.Future)2 SimpleRateLimiter (org.apache.lucene.store.RateLimiter.SimpleRateLimiter)2 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Writer (java.io.Writer)1 Path (java.nio.file.Path)1 Callable (java.util.concurrent.Callable)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Pattern (java.util.regex.Pattern)1 MockAnalyzer (org.apache.lucene.analysis.MockAnalyzer)1 Document (org.apache.lucene.document.Document)1 FieldType (org.apache.lucene.document.FieldType)1 LeafReaderContext (org.apache.lucene.index.LeafReaderContext)1