ControlledRealTimeReopenThread

open class ControlledRealTimeReopenThread<T>(writer: IndexWriter, manager: ReferenceManager<T>, targetMaxStaleSec: Double, targetMinStaleSec: Double) : Thread, Closeable

Utility class that runs a thread to manage periodicc reopens of a ReferenceManager, with methods to wait for a specific index changes to become visible. When a given search request needs to see a specific index change, call the {#waitForGeneration} to wait for that change to be visible. Note that this will only scale well if most searches do not need to wait for a specific index generation.

Constructors

Link copied to clipboard
constructor(writer: IndexWriter, manager: ReferenceManager<T>, targetMaxStaleSec: Double, targetMinStaleSec: Double)

Functions

Link copied to clipboard
open override fun close()

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns which generation the current searcher is guaranteed to include.

Link copied to clipboard
fun interrupt()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun join()
fun join(millis: Long)
Link copied to clipboard
open override fun run()
Link copied to clipboard
Link copied to clipboard
fun setName(name: String)
Link copied to clipboard
fun setPriority(newPriority: Int)
Link copied to clipboard
open fun start()
Link copied to clipboard
fun waitForGeneration(targetGen: Long)

Waits for the target generation to become visible in the searcher. If the current searcher is older than the target generation, this method will block until the searcher is reopened, by another via ReferenceManager.maybeRefresh or until the ReferenceManager is closed.

fun waitForGeneration(targetGen: Long, maxMS: Int): Boolean

Waits for the target generation to become visible in the searcher, up to a maximum specified milli-seconds. If the current searcher is older than the target generation, this method will block until the searcher has been reopened by another thread via ReferenceManager.maybeRefresh, the given waiting time has elapsed, or until the ReferenceManager is closed.