• API

    Show / Hide Table of Contents

    Class Lock.With<T>

    Utility class for executing code with exclusive access.

    Inheritance
    System.Object
    Lock.With<T>
    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)
    System.Object.ToString()
    Namespace: Lucene.Net.Store
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class With<T>
    Type Parameters
    Name Description
    T

    Constructors

    | Improve this Doc View Source

    With(Lock, Int64)

    Constructs an executor that will grab the named lock.

    Declaration
    public With(Lock lock, long lockWaitTimeout)
    Parameters
    Type Name Description
    Lock lock

    the Lock instance to use

    System.Int64 lockWaitTimeout

    length of time to wait in milliseconds or LOCK_OBTAIN_WAIT_FOREVER to retry forever

    Methods

    | Improve this Doc View Source

    DoBody()

    Code to execute with exclusive access.

    Declaration
    protected abstract T DoBody()
    Returns
    Type Description
    T
    | Improve this Doc View Source

    Run()

    Calls DoBody() while lock is obtained. Blocks if lock cannot be obtained immediately. Retries to obtain lock once per second until it is obtained, or until it has tried ten times. Lock is released when DoBody() exits.

    Declaration
    public virtual T Run()
    Returns
    Type Description
    T
    Exceptions
    Type Condition
    LockObtainFailedException

    if lock could not be obtained

    System.IO.IOException

    if Obtain() throws System.IO.IOException

    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)