private void removeFile(PnfsId pnfsId) {
   try {
     repository.setState(pnfsId, ReplicaState.REMOVED);
   } catch (IllegalTransitionException f) {
     LOGGER.warn(
         "File not found in name space, but failed to remove {}: {}", pnfsId, f.getMessage());
   } catch (CacheException f) {
     LOGGER.error(
         "File not found in name space, but failed to remove {}: {}", pnfsId, f.getMessage());
   } catch (InterruptedException f) {
     LOGGER.warn("File not found in name space, but failed to remove {}: {}", pnfsId, f);
   }
 }
 public void failed(Exception cause) {
   if (cause instanceof InterruptedException || cause instanceof CancellationException) {
     cause = new TimeoutCacheException("Stage was cancelled.", cause);
   }
   LOGGER.warn("Remove of {} failed with {}.", uri, cause);
   removeRequests.removeAndCallback(uri, cause);
 }
    private void done(Throwable cause) {
      PnfsId pnfsId = getFileAttributes().getPnfsId();
      if (cause != null) {
        if (cause instanceof InterruptedException || cause instanceof CancellationException) {
          cause = new TimeoutCacheException("Flush was cancelled.", cause);
        }

        if (cause instanceof CacheException) {
          infoMsg.setResult(((CacheException) cause).getRc(), cause.getMessage());
        } else {
          infoMsg.setResult(CacheException.DEFAULT_ERROR_CODE, cause.getMessage());
        }
      }

      infoMsg.setTransferTime(System.currentTimeMillis() - activatedAt);
      infoMsg.setFileSize(getFileAttributes().getSize());
      infoMsg.setTimeQueued(activatedAt - createdAt);

      if (!suppressedStoreErrors.contains(infoMsg.getResultCode())) {
        if (infoMsg.getResultCode() != 0) {
          LOGGER.warn("Flush of {} failed with: {}.", pnfsId, cause.toString());
        }
        billingStub.notify(infoMsg);
      }

      flushRequests.removeAndCallback(pnfsId, cause);
    }
 private void done(Throwable cause) {
   PnfsId pnfsId = getFileAttributes().getPnfsId();
   if (cause != null) {
     if (cause instanceof InterruptedException || cause instanceof CancellationException) {
       cause = new TimeoutCacheException("Stage was cancelled.", cause);
     }
     LOGGER.warn("Stage of {} failed with {}.", pnfsId, cause);
   }
   descriptor.close();
   if (cause instanceof CacheException) {
     infoMsg.setResult(((CacheException) cause).getRc(), cause.getMessage());
   } else if (cause != null) {
     infoMsg.setResult(CacheException.DEFAULT_ERROR_CODE, cause.toString());
   }
   infoMsg.setTransferTime(System.currentTimeMillis() - activatedAt);
   billingStub.notify(infoMsg);
   stageRequests.removeAndCallback(pnfsId, cause);
 }