Class ShardLock

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

public abstract class ShardLock
extends java.lang.Object
implements java.io.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:
NodeEnvironment
  • Constructor Summary

    Constructors
    Constructor Description
    ShardLock​(ShardId id)  
  • Method Summary

    Modifier and Type Method Description
    void close()  
    protected abstract void closeInternal()  
    ShardId getShardId()
    Returns the locks shards Id.
    void setDetails​(java.lang.String details)
    Update the details of the holder of this lock.
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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 java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
    • closeInternal

      protected abstract void closeInternal()
    • setDetails

      public void setDetails​(java.lang.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 java.lang.String toString()
      Overrides:
      toString in class java.lang.Object