Class ShardLock

java.lang.Object
org.elasticsearch.env.ShardLock
All Implemented Interfaces:
Closeable, AutoCloseable

public abstract class ShardLock extends Object implements Closeable
A shard lock guarantees exclusive access to a shards data directory. Internal processes should acquire a lock on a shard before executing any write operations on the shards data directory.
See Also:
  • Constructor Details

    • ShardLock

      public ShardLock(ShardId id)
  • Method Details

    • getShardId

      public final ShardId getShardId()
      Returns the locks shards Id.
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • closeInternal

      protected abstract void closeInternal()
    • setDetails

      public void setDetails(String details)
      Update the details of the holder of this lock. These details are displayed alongside a ShardLockObtainFailedException. Must only be called by the holder of this lock.
    • toString

      public String toString()
      Overrides:
      toString in class Object