@Override
   public void deleteOrReleaseReadLock(final String filename) {
      if (isMultiChunked(filename)) {
         int newValue = 0;
         FileReadLockKey readLockKey = new FileReadLockKey(indexName, filename, affinitySegmentId);
         boolean done = false;
         Object lockValue = locksCache.get(readLockKey);
         while (!done) {
            if (lockValue == null) {
               lockValue = locksCache.putIfAbsent(readLockKey, 0);
               done = (null == lockValue);
            }
            else {
               Integer refCountObject = (Integer) lockValue;
               int refCount = refCountObject.intValue();
               newValue = refCount - 1;
               done = locksCache.replace(readLockKey, refCountObject, newValue);
               if (!done) {
                  lockValue = locksCache.get(readLockKey);
               }
            }
         }
         if (newValue == 0) {
            realFileDelete(indexName, filename, locksCache, chunksCache, metadataCache, forceSynchronousDeletes, affinitySegmentId);
         }
      }
      else {
         realFileDelete(indexName, filename, locksCache, chunksCache, metadataCache, forceSynchronousDeletes, affinitySegmentId);
      }
   }
@ Override public void deleteOrReleaseReadLock ( final String filename ) { if ( isMultiChunked ( filename ) ) { int newValue = 0 ; FileReadLockKey readLockKey = new FileReadLockKey ( indexName , filename , affinitySegmentId ) ; boolean done = false ; Object lockValue = locksCache . get ( readLockKey ) ; while ( ! done ) { if ( lockValue == null ) { lockValue = locksCache . putIfAbsent ( readLockKey , 0 ) ; done = ( null == lockValue ) ; } else { Integer refCountObject = ( Integer ) lockValue ; int refCount = refCountObject . intValue ( ) ; newValue = refCount - 1 ; done = locksCache . replace ( readLockKey , refCountObject , newValue ) ; if ( ! done ) { lockValue = locksCache . get ( readLockKey ) ; } } } if ( newValue == 0 ) { realFileDelete ( indexName , filename , locksCache , chunksCache , metadataCache , forceSynchronousDeletes , affinitySegmentId ) ; } } else { realFileDelete ( indexName , filename , locksCache , chunksCache , metadataCache , forceSynchronousDeletes , affinitySegmentId ) ; } }
Deletes or releases a read-lock for the specified filename, so that if it was marked as deleted and
no other {@link org.infinispan.lucene.impl.InfinispanIndexInput} instances are reading from it, then it will
be effectively deleted.

@see #acquireReadLock(String)
@see org.apache.lucene.store.Directory#deleteFile(String)