since we can recover without any consequence
481456
public int readMarker(SequenceFile.Reader reader) throws IOException {
    if (valueBytes == null) {
      valueBytes = reader.createValueBytes();
    }
    rawKey.reset();
    rawValue.reset();

    // valueBytes need not be reset since nextRaw call does it (and it is a private method)
    int status = reader.nextRaw(rawKey, valueBytes);

    // if we reach EOF, return -1
    if (status == -1) {
      return -1;
    }

    // Check if the marker key is valid and return the count
    if (isMarkerValid()) {
      valueBytes.writeUncompressedBytes(rawValue);
      rawValue.flush();
      // rawValue.getData() may return a larger byte array but Ints.fromByteArray will only read the first four bytes
      return Ints.fromByteArray(rawValue.getData());
    }

    // EOF not reached and marker is not valid, then thrown an IOException since we can't make progress
    throw new IOException(String.format("Invalid key for num entries appended found %s, expected : %s",
                                        new String(rawKey.getData()), TxConstants.TransactionLog.NUM_ENTRIES_APPENDED));
  }
772551
def execute(self, result=None):
        
        try:
            return self.unsafe_execute(result=result)
        except Exception as exc:
            return self._onerror(Result.from_exception(exc, uuid=self.uuid))
712136
public static void validateRecovery(Exception ex, CxxLanguage language) {
    Optional<Boolean> recovery = language.IsRecoveryEnabled();
    if (recovery.isPresent() && recovery.get()) {
      return;
    }
    LOG.info("Recovery is disabled, failing analysis : '{}'", ex.toString());
    throw new IllegalStateException(ex.getMessage(), ex.getCause());
  }
1346271
private boolean doNotShutdownOnRecoveryFailure() {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "doNotShutdownOnRecoveryFailure");

        boolean doCheck = true;
        Boolean doNotShutdownOnRecoveryFailure = null;

        try {
            doNotShutdownOnRecoveryFailure = AccessController.doPrivileged(
                                                                           new PrivilegedExceptionAction<Boolean>() {
                                                                               @Override
                                                                               public Boolean run() {
                                                                                   Boolean theResult = Boolean.getBoolean("com.ibm.ws.recoverylog.spi.DoNotShutdownOnRecoveryFailure");
                                                                                   if (tc.isDebugEnabled())
                                                                                       Tr.debug(tc, "Have retrieved jvm property with result, " + theResult.booleanValue());
                                                                                   return theResult;
                                                                               }
                                                                           });
        } catch (PrivilegedActionException e) {
            if (tc.isDebugEnabled())
                Tr.debug(tc, "Exception getting DoNotShutdownOnRecoveryFailure property", e);
            doNotShutdownOnRecoveryFailure = null;
        }

        if (doNotShutdownOnRecoveryFailure == null)
            doNotShutdownOnRecoveryFailure = Boolean.TRUE;

        doCheck = doNotShutdownOnRecoveryFailure.booleanValue();
        if (tc.isEntryEnabled())
            Tr.exit(tc, "doNotShutdownOnRecoveryFailure", doCheck);
        return doCheck;
    }
1036358
boolean processUnstable() {
        boolean change = !unstable;
        if (change) {  // Only once until the process is removed. A process is unstable until removed.
            unstable = true;
            HostControllerLogger.ROOT_LOGGER.managedServerUnstable(serverName);
        }
        return change;
    }
1187785
@Override
    public void onFailure(Throwable t) {
        if (cancelled) {
            return;
        }

        t = adjustThrowable(t);
        if (handleInternalException(t)) {
            next();
        } else {
            cancel();
        }
    }
1074900
public void recover() {
    try {
      boolean checkpointExists = mUfs.isFile(mCheckpoint.toString());
      boolean backupCheckpointExists = mUfs.isFile(mBackupCheckpoint.toString());
      boolean tempBackupCheckpointExists = mUfs.isFile(mTempBackupCheckpoint.toString());
      Preconditions
          .checkState(!(checkpointExists && backupCheckpointExists && tempBackupCheckpointExists),
              "checkpoint, temp backup checkpoint, and backup checkpoint should never all exist ");
      if (tempBackupCheckpointExists) {
        // If mCheckpointPath also exists, step 2 must have implemented rename as copy + delete, and
        // failed during the delete.
        UnderFileSystemUtils.deleteFileIfExists(mUfs, mCheckpoint.toString());
        mUfs.renameFile(mTempBackupCheckpoint.toString(), mCheckpoint.toString());
      }
      if (backupCheckpointExists) {
        // We must have crashed after step 3
        if (checkpointExists) {
          // We crashed after step 4, so we can finish steps 5 and 6.
          mWriter.deleteCompletedLogs();
          mUfs.deleteFile(mBackupCheckpoint.toString());
        } else {
          // We crashed before step 4, so we roll back to the backup checkpoint.
          mUfs.renameFile(mBackupCheckpoint.toString(), mCheckpoint.toString());
        }
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
327470
function ok(inst, transaction) {
    if (transaction === undefined) transaction = 0;
    inst.balance = inst.balance + transaction;
    var _ok = inst.balance > 0 && Date.now() < inst.timeout;
    return _ok;
}
308053
def ensure_result(self, supress_exception = False, defaultresult = None):
        '''
        
        '''
        try:
            yield self
        except Exception as exc:
            if not self.done():
                self.set_exception(exc)
            if not supress_exception:
                raise
        except:
            if not self.done():
                self.set_exception(FutureCancelledException('cancelled'))
            raise
        else:
            if not self.done():
                self.set_result(defaultresult)
433416
def safe_either(method, dictionary, key1, key2, default_value=None):
        """"""
        value = method(dictionary, key1)
        return value if value is not None else method(dictionary, key2, default_value)
242649
function noOp (error) {
    if (error == null) return
    error = pruneErrorStack(error)
    nextTick(function () {
      if (isFunction(thunks.onerror)) thunks.onerror(error)
      else throw error
    })
  }
411471
def no_operation(self, onerror = None):
        """"""
        request.NoOperation(display = self.display,
                            onerror = onerror)
455794
private function canRetry()
    {
        if ($this->isUnlimitedAttempts()) {
            return true;
        }

        $this->attempts++;

        return $this->attempts < $this->maxAttempts;
    }
681764
public static final boolean isRecoverable()
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "isRecoverable");

        // This JTS is recoverable if there is a server name.
        // boolean result = (serverName != null);
        // JTA2 - we are recoverable if we have a working log...
        // We can have a serverName but no working log either because
        // a) the log config or store is invalid
        // b) the log config indicates no logging.
        //
        boolean result = false;
        if (_failureScopeController != null)
        {
            result = (_failureScopeController.getTransactionLog() != null);
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "isRecoverable", Boolean.valueOf(result));
        return result;
    }
943999
@Override
    public void recover() {

        // not revoverable
        if (this.getCoreConnection() == null || !ImplementorUtils.isImplementationOf(getCoreConnection(), IXADataRecorderAware.class)) {
            return;
        }

        IXADataRecorderAware con = ImplementorUtils.cast(getCoreConnection(), IXADataRecorderAware.class);

        // the connection has to re establish the state of the message LOG
        IXADataRecorder msgLogger = this.getXADataRecorder();
        if (msgLogger.isEmpty()) {
            return;
        }
        this.fireConnectionRecovering();
        IDataRecordReplay dataRecordReplay = con.recoverReplayListener();

        if( dataRecordReplay==null) {
            throw new IllegalStateException("IPhynixxConnection.recoverReplayListener() has to provide a IDataRecordReplay to be recovered");
        }

        // msgLogger.recover();
        msgLogger.replayRecords(dataRecordReplay);

        this.fireConnectionRecovered();

    }
740030
protected void beforeRestart(final Throwable reason) {
    // override for specific recovery

    logger().log("Default before restart recovery after: " + reason.getMessage(), reason);

    lifeCycle.afterStop(this);
  }
471787
private void onStateChange(Session.State state) {
    switch (state) {
      // When the session is opened, transition the state to CONNECTED.
      case OPEN:
        setState(State.CONNECTED);
        break;
      // When the session becomes unstable, transition the state to SUSPENDED.
      case UNSTABLE:
        setState(State.SUSPENDED);
        break;
      case STALE:
        setState(State.SUSPENDED);
        this.close();
        break;
      // When the session is expired, transition the state to SUSPENDED if necessary. The recovery strategy
      // must determine whether to attempt to recover the client.
      case EXPIRED:
        setState(State.SUSPENDED);
        recoveryStrategy.recover(this);
        break;
      case CLOSED:
        setState(State.CLOSED);
        break;
      default:
        break;
    }
  }