Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class Lock.With<T>

    Utility class for executing code with exclusive access.

    Inheritance
    object
    Lock.With<T>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Store
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class Lock.With<T>
    Type Parameters
    Name Description
    T

    Constructors

    With(Lock, long)

    Constructs an executor that will grab the named lock.

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

    the Lock instance to use

    long lockWaitTimeout

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

    Methods

    DoBody()

    Code to execute with exclusive access.

    Declaration
    protected abstract T DoBody()
    Returns
    Type Description
    T

    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

    IOException

    if Obtain() throws IOException

    Back to top Copyright © 2024 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.