@Override public SnapshotLock obtainSnapshotLock() throws Exception {
if (!snapshotLock) {
return NO_SNAPSHOT_LOCK;
}
AbstractFsBlobContainer fsBlobContainer = (AbstractFsBlobContainer) blobContainer;
NativeFSLockFactory lockFactory = new NativeFSLockFactory(fsBlobContainer.filePath());
Lock lock = lockFactory.makeLock("snapshot.lock");
boolean obtained = lock.obtain();
if (!obtained) {
throw new ElasticSearchIllegalStateException("failed to obtain snapshot lock [" + lock + "]");