Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class ReplicationClient

    A client which monitors and obtains new revisions from a IReplicator. It can be used to either periodically check for updates by invoking StartUpdateThread(Int64, String), or manually by calling UpdateNow().

    Whenever a new revision is available, the RequiredFiles(IDictionary<String, IList<RevisionFile>>) are copied to the Lucene.Net.Store.Directory specified by PerSessionDirectoryFactory and a handler is notified.

    Inheritance
    System.Object
    ReplicationClient
    Implements
    System.IDisposable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Lucene.Net.Replicator
    Assembly: Lucene.Net.Replicator.dll
    Syntax
    public class ReplicationClient : IDisposable
    Remarks
    Note

    This API is experimental and might change in incompatible ways in the next release.

    Constructors

    | Improve this Doc View Source

    ReplicationClient(IReplicator, IReplicationHandler, ISourceDirectoryFactory)

    Constructor.

    Declaration
    public ReplicationClient(IReplicator replicator, IReplicationHandler handler, ISourceDirectoryFactory factory)
    Parameters
    Type Name Description
    IReplicator replicator

    The IReplicator used for checking for updates

    IReplicationHandler handler

    The IReplicationHandler notified when new revisions are ready

    ISourceDirectoryFactory factory

    The ISourceDirectoryFactory for returning a Lucene.Net.Store.Directory for a given source and session

    Fields

    | Improve this Doc View Source

    INFO_STREAM_COMPONENT

    The component name to use with IsEnabled(String)

    Declaration
    public const string INFO_STREAM_COMPONENT = "ReplicationThread"
    Field Value
    Type Description
    System.String

    Properties

    | Improve this Doc View Source

    InfoStream

    Gets or sets the Lucene.Net.Util.InfoStream to use for logging messages.

    Declaration
    public virtual InfoStream InfoStream { get; set; }
    Property Value
    Type Description
    Lucene.Net.Util.InfoStream
    | Improve this Doc View Source

    IsUpdateThreadAlive

    Returns true if the update thread is alive. The update thread is alive if it has been StartUpdateThread(Int64, String) and not StopUpdateThread(), as well as didn't hit an error which caused it to terminate (i.e. HandleUpdateException(Exception) threw the exception further).

    Declaration
    public virtual bool IsUpdateThreadAlive { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    Dispose()

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

    Dispose(Boolean)

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing
    | Improve this Doc View Source

    EnsureOpen()

    Throws System.ObjectDisposedException if the client has already been disposed.

    Declaration
    protected void EnsureOpen()
    | Improve this Doc View Source

    HandleUpdateException(Exception)

    Called when an exception is hit by the replication thread. The default implementation prints the full stacktrace to the Lucene.Net.Util.InfoStream set in InfoStream, or the Lucene.Net.Util.InfoStream.Default one. You can override to log the exception elsewhere.

    Declaration
    protected virtual void HandleUpdateException(Exception exception)
    Parameters
    Type Name Description
    System.Exception exception
    Remarks

    NOTE: If you override this method to throw the exception further, the replication thread will be terminated. The only way to restart it is to call StopUpdateThread() followed by StartUpdateThread(Int64, String).

    | Improve this Doc View Source

    RequiredFiles(IDictionary<String, IList<RevisionFile>>)

    Returns the files required for replication. By default, this method returns all files that exist in the new revision, but not in the handler.

    Declaration
    protected virtual IDictionary<string, IList<RevisionFile>> RequiredFiles(IDictionary<string, IList<RevisionFile>> newRevisionFiles)
    Parameters
    Type Name Description
    System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IList<RevisionFile>> newRevisionFiles
    Returns
    Type Description
    System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IList<RevisionFile>>
    | Improve this Doc View Source

    StartUpdateThread(Int64, String)

    Start the update thread with the specified interval in milliseconds. For debugging purposes, you can optionally set the name to set on J2N.Threading.ThreadJob.Name. If you pass null, a default name will be set.

    Declaration
    public virtual void StartUpdateThread(long intervalInMilliseconds, string threadName)
    Parameters
    Type Name Description
    System.Int64 intervalInMilliseconds
    System.String threadName
    Exceptions
    Type Condition
    System.InvalidOperationException

    if the thread has already been started

    | Improve this Doc View Source

    StopUpdateThread()

    Stop the update thread. If the update thread is not running, silently does nothing. This method returns after the update thread has stopped.

    Declaration
    public virtual void StopUpdateThread()
    | Improve this Doc View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.Object.ToString()
    | Improve this Doc View Source

    UpdateNow()

    Executes the update operation immediately, regardless if an update thread is running or not.

    Declaration
    public virtual void UpdateNow()
    Exceptions
    Type Condition
    System.IO.IOException

    Implements

    System.IDisposable
    • Improve this Doc
    • View Source
    Back to top Copyright © 2022 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.