Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class ControlledRealTimeReopenThread<T>

    Utility class that runs a thread to manage periodic reopens of a ReferenceManager<G>, with methods to wait for a specific index changes to become visible. To use this class you must first wrap your IndexWriter with a TrackingIndexWriter and always use it to make changes to the index, saving the returned generation. Then, when a given search request needs to see a specific index change, call the WaitForGeneration(Int64) 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.

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk
    Inheritance
    System.Object
    J2N.Threading.ThreadJob
    ControlledRealTimeReopenThread<T>
    Implements
    System.IEquatable<J2N.Threading.ThreadJob>
    System.IEquatable<System.Threading.Thread>
    System.IDisposable
    Inherited Members
    J2N.Threading.ThreadJob.SafeRun(System.Threading.ThreadStart)
    J2N.Threading.ThreadJob.Start()
    J2N.Threading.ThreadJob.Interrupt()
    J2N.Threading.ThreadJob.Join()
    J2N.Threading.ThreadJob.Join(System.Int64)
    J2N.Threading.ThreadJob.Join(System.Int64, System.Int32)
    J2N.Threading.ThreadJob.Resume()
    J2N.Threading.ThreadJob.Abort()
    J2N.Threading.ThreadJob.Abort(System.Object)
    J2N.Threading.ThreadJob.Yield()
    J2N.Threading.ThreadJob.Suspend()
    J2N.Threading.ThreadJob.Sleep(System.Int64)
    J2N.Threading.ThreadJob.Sleep(System.Int64, System.Int32)
    J2N.Threading.ThreadJob.Sleep(System.TimeSpan)
    J2N.Threading.ThreadJob.Interrupted()
    J2N.Threading.ThreadJob.Equals(System.Threading.Thread)
    J2N.Threading.ThreadJob.Equals(J2N.Threading.ThreadJob)
    J2N.Threading.ThreadJob.Equals(System.Object)
    J2N.Threading.ThreadJob.GetHashCode()
    J2N.Threading.ThreadJob.ToString()
    J2N.Threading.ThreadJob.SyncRoot
    J2N.Threading.ThreadJob.Instance
    J2N.Threading.ThreadJob.CurrentThread
    J2N.Threading.ThreadJob.Name
    J2N.Threading.ThreadJob.State
    J2N.Threading.ThreadJob.Priority
    J2N.Threading.ThreadJob.IsAlive
    J2N.Threading.ThreadJob.IsBackground
    J2N.Threading.ThreadJob.IsDebug
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public class ControlledRealTimeReopenThread<T> : ThreadJob, IEquatable<ThreadJob>, IEquatable<Thread>, IDisposable where T : class
    Type Parameters
    Name Description
    T

    Constructors

    | Improve this Doc View Source

    ControlledRealTimeReopenThread(TrackingIndexWriter, ReferenceManager<T>, Double, Double)

    Create ControlledRealTimeReopenThread<T>, to periodically reopen the a ReferenceManager<G>.

    Declaration
    public ControlledRealTimeReopenThread(TrackingIndexWriter writer, ReferenceManager<T> manager, double targetMaxStaleSec, double targetMinStaleSec)
    Parameters
    Type Name Description
    TrackingIndexWriter writer
    ReferenceManager<T> manager
    System.Double targetMaxStaleSec

    Maximum time until a new reader must be opened; this sets the upper bound on how slowly reopens may occur, when no caller is waiting for a specific generation to become visible.

    System.Double targetMinStaleSec

    Mininum time until a new reader can be opened; this sets the lower bound on how quickly reopens may occur, when a caller is waiting for a specific generation to become visible.

    Methods

    | Improve this Doc View Source

    Dispose()

    Releases all resources used by the ControlledRealTimeReopenThread<T>.

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    Dispose(Boolean)

    Releases resources used by the ControlledRealTimeReopenThread<T> and if overridden in a derived class, optionally releases unmanaged resources.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    true to release both managed and unmanaged resources; false to release only unmanaged resources.

    | Improve this Doc View Source

    Run()

    Declaration
    public override void Run()
    Overrides
    J2N.Threading.ThreadJob.Run()
    | Improve this Doc View Source

    WaitForGeneration(Int64)

    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 MaybeRefresh() or until the ReferenceManager<G> is closed.

    Declaration
    public virtual void WaitForGeneration(long targetGen)
    Parameters
    Type Name Description
    System.Int64 targetGen

    The generation to wait for

    | Improve this Doc View Source

    WaitForGeneration(Int64, Int32)

    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 MaybeRefresh(), the given waiting time has elapsed, or until the ReferenceManager<G> is closed.

    NOTE: if the waiting time elapses before the requested target generation is available the current SearcherManager is returned instead.

    Declaration
    public virtual bool WaitForGeneration(long targetGen, int maxMS)
    Parameters
    Type Name Description
    System.Int64 targetGen

    The generation to wait for

    System.Int32 maxMS

    Maximum milliseconds to wait, or -1 to wait indefinitely

    Returns
    Type Description
    System.Boolean

    true if the targetGen is now available, or false if maxMS wait time was exceeded

    Implements

    System.IEquatable<T>
    System.IEquatable<T>
    System.IDisposable
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.