private void pingSessionBackup(@Nonnull final MemcachedBackupSession session)
     throws InterruptedException {
   final String key = _sessionIdFormat.createBackupKey(session.getId());
   final Future<Boolean> touchResultFuture = _memcached.add(key, 5, 1);
   try {
     final boolean touchResult =
         touchResultFuture.get(_manager.getOperationTimeout(), TimeUnit.MILLISECONDS);
     if (touchResult) {
       _log.warn(
           "The secondary backup for session "
               + session.getIdInternal()
               + " should be touched in memcached, but it seemed to be"
               + " not existing. Will store in memcached again.");
       saveSessionBackup(session, key);
     } else _log.debug("The secondary session backup was ping'ed successfully.");
   } catch (final TimeoutException e) {
     _log.warn(
         "The secondary backup for session "
             + session.getIdInternal()
             + " could not be completed within "
             + _manager.getOperationTimeout()
             + " millis, was cancelled now.");
   } catch (final ExecutionException e) {
     _log.warn(
         "An exception occurred when trying to ping session " + session.getIdInternal(), e);
   }
 }
    @Override
    public Void call() throws Exception {

      final BackupResult backupResult = _result.get();

      if (_pingSessionIfBackupWasSkipped) {
        if (backupResult.getStatus() == BackupResultStatus.SKIPPED) {
          pingSession(_session, _backupSessionService);
        }
      }

      /*
       * For non-sticky sessions we store a backup of the session in a secondary memcached node (under a special key
       * that's resolved by the SuffixBasedNodeLocator), but only when we have more than 1 memcached node configured...
       */
      if (_storeSecondaryBackup) {
        try {
          if (_log.isDebugEnabled()) {
            _log.debug(
                "Storing backup in secondary memcached for non-sticky session " + _session.getId());
          }
          if (backupResult.getStatus() == BackupResultStatus.SKIPPED) {
            pingSessionBackup(_session);
          } else {
            saveSessionBackupFromResult(backupResult);
          }

          saveValidityBackup();
        } catch (final RuntimeException e) {
          _log.info("Could not store secondary backup of session " + _session.getIdInternal(), e);
        }
      }

      return null;
    }
 public void saveSessionBackupFromResult(final BackupResult backupResult) {
   final byte[] data = backupResult.getData();
   if (data != null) {
     final String key = _sessionIdFormat.createBackupKey(_session.getId());
     _memcached.set(
         key, toMemcachedExpiration(_session.getMemcachedExpirationTimeToSet()), data);
   } else {
     _log.warn(
         "No data set for backupResultStatus "
             + backupResult.getStatus()
             + " for sessionId "
             + _session.getIdInternal()
             + ", skipping backup"
             + " of non-sticky session in secondary memcached.");
   }
 }