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 Directory specified by PerSessionDirectoryFactory and a handler is notified.

    Inheritance
    System.Object
    ReplicationClient
    Namespace: Lucene.Net.Replicator
    Assembly: Lucene.Net.Replicator.dll
    Syntax
    public class ReplicationClient : IDisposable
    Remarks
    This is a Lucene.NET EXPERIMENTAL API, use at your own risk

    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 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 = null
    Field Value
    Type Description
    System.String

    Properties

    | Improve this Doc View Source

    InfoStream

    Gets or sets the InfoStream to use for logging messages.

    Declaration
    public virtual InfoStream InfoStream { get; set; }
    Property Value
    Type Description
    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 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 InfoStream set in InfoStream, or the Default one. You can override to log the exception elsewhere.

    Declaration
    protected virtual void HandleUpdateException(Exception exception)
    Parameters
    Type Name Description
    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
    IDictionary<System.String, IList<RevisionFile>> newRevisionFiles
    Returns
    Type Description
    IDictionary<System.String, 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 Lucene.Net.Replicator.ReplicationClient.ReplicationThread.Name. If you pass null, a default name will be set.

    Declaration
    public virtual void StartUpdateThread(long intervalMillis, string threadName)
    Parameters
    Type Name Description
    System.Int64 intervalMillis
    System.String threadName
    | 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
    | 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()
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)