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);
    }
 @Override
 public void failed(Throwable exc, PnfsId pnfsId) {
   reply(
       "Failed to fetch "
           + pnfsId
           + ": "
           + (exc instanceof CacheException ? exc.getMessage() : exc));
 }
 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);
 }