Switch to next startegy. If an error occured,
        stay with the first strategy
497706
def makeTempFile(self):
        

        if self.strategy == 0:
            try:
                new_delegate = self.STRATEGIES[1]()
                new_delegate.write(self.getvalue())
                self._delegate = new_delegate
                self.strategy = 1
                log.warn("Created temporary file %s", self.name)
            except:
                self.capacity = - 1
451618
public void doFirstChecks(Work work, long startTimeout, ExecutionContext execContext) throws WorkException
   {
      if (isShutdown())
         throw new WorkRejectedException(bundle.workmanagerShutdown());

      if (work == null)
         throw new WorkRejectedException(bundle.workIsNull());

      if (startTimeout < 0)
         throw new WorkRejectedException(bundle.startTimeoutIsNegative(startTimeout));

      checkAndVerifyWork(work, execContext);
   }
276122
def reset_for_retry(self):
    """"""
    self.retries += 1
    self.last_work_item = ""
    self.active = True
    self.result_status = None
    self.input_finished = False
    self.counters_map = CountersMap()
    self.slice_id = 0
    self.slice_start_time = None
    self.slice_request_id = None
    self.slice_retries = 0
    self.acquired_once = False
76151
private void tryInitialize(boolean checkTermination) {
        if (runState == 0) { // bootstrap by locking static field
            int p = config & SMASK;
            int n = (p > 1) ? p - 1 : 1; // ensure at least 2 slots
            n |= n >>> 1;    // create workQueues array with size a power of two
            n |= n >>> 2;
            n |= n >>> 4;
            n |= n >>> 8;
            n |= n >>> 16;
            n = ((n + 1) << 1) & SMASK;
            AuxState aux = new AuxState();
            WorkQueue[] ws = new WorkQueue[n];
            synchronized (modifyThreadPermission) { // double-check
                if (runState == 0) {
                    workQueues = ws;
                    auxState = aux;
                    runState = STARTED;
                }
            }
        }
        if (checkTermination && runState < 0) {
            tryTerminate(false, false); // help terminate
            throw new RejectedExecutionException();
        }
    }
1229597
private void tryRunNext() {
        while (runningSemaphore.tryAcquire()) {
            ExecutionTask execution = queue.poll();
            if (execution != null) {
                // Note: we've removed the execution from the queue so we're committed to running it
                // if we fail to do so for any reason, we need to call the exception handler to fail the execution
                try {
                    execution.submit();
                } catch (Throwable e) {
                    // Any exception here is unexpected
                    runningSemaphore.release();
                    execution.exceptionHandler.handle(e);
                }
            } else {
                runningSemaphore.release();
                break;
            }
        }
    }
418707
public Retryer<R> withStopStrategy(StopStrategy stopStrategy) {
        checkState(this.stopStrategy == null, "A stop strategy has already been set %s", this.stopStrategy);
        this.stopStrategy = checkNotNull(stopStrategy, "StopStrategy cannot be null");
        return this;
    }
1366903
function (successCallback, errorCallback) {
		winble.logger.logApiEntry("startScan");
		winble.deviceManager.startScan(successCallback, errorCallback);
		winble.logger.logApiExit("startScan");
	}
718338
function maybeStart(priv) {
  if (priv.started) {
    return;
  }
  priv.elem.addEventListener(feature.transitionEventName, handleTransitionEnd.bind(null, priv));
  priv.started = true;
}
64905
function onError (e) {
            switch (e.target.errorCode) {
            case 12:
                console.log('Error - Attempt to open db with a lower version than the ' +
                        'current one.');
                break;
            default:
                console.log('errorCode: ' + e.target.errorCode);
            }

            console.log(e, e.code, e.message);
        }
444326
def skip(num):
    """"""
    click.echo("Current problem is problem %i." % num)
    generate(num + 1, prompt_default=False)
    Problem(num).file.change_suffix('-skipped')
421190
function next(err) {
      return finish(function (finishErr) {
        if (err) return topnext(err);
        else if (finishErr) return topnext(finishErr);
        else return topnext();
      });
    }
1374846
private void switchToForward() {
        assert(state == State.ITER_CHECK_BWD ||
                (state == State.ITER_IN_FCD_SEGMENT && pos == limit) ||
                (state.compareTo(State.IN_NORM_ITER_AT_LIMIT) >= 0 && pos == normalized.length()));
        if(state == State.ITER_CHECK_BWD) {
            // Turn around from backward checking.
            start = pos = iter.getIndex();
            if(pos == limit) {
                state = State.ITER_CHECK_FWD;  // Check forward.
            } else {  // pos < limit
                state = State.ITER_IN_FCD_SEGMENT;  // Stay in FCD segment.
            }
        } else {
            // Reached the end of the FCD segment.
            if(state == State.ITER_IN_FCD_SEGMENT) {
                // The input text segment is FCD, extend it forward.
            } else {
                // The input text segment needed to be normalized.
                // Switch to checking forward from it.
                if(state == State.IN_NORM_ITER_AT_START) {
                    iter.moveIndex(limit - start);
                }
                start = limit;
            }
            state = State.ITER_CHECK_FWD;
        }
    }
878846
protected void checkStartStatus(BundleStartStatus startStatus) throws InvalidBundleContextException {
        final String m = "checkInstallStatus";
        if (startStatus.startExceptions()) {
            Map<Bundle, Throwable> startExceptions = startStatus.getStartExceptions();
            for (Entry<Bundle, Throwable> entry : startExceptions.entrySet()) {
                Bundle b = entry.getKey();
                FFDCFilter.processException(entry.getValue(), ME, m, this,
                                            new Object[] { b.getLocation() });
            }

            throw new LaunchException("Exceptions occurred while starting platform bundles", BootstrapConstants.messages.getString("error.platformBundleException"));
        }

        if (!startStatus.contextIsValid())
            throw new InvalidBundleContextException();
    }
1336559
void resetSequential() {
        seq = nextLong(prand, maxSeq);
        inc = minInc + nextLong(prand, maxInc - minInc);
    }
274047
def reset_error_status(self):
        
        try:
            return self.feature_error or self.scenario_error
        finally:
            self.feature_error = False
            self.scenario_error = False
1286205
def switch(self, idx, u):
        """"""
        self.u[self.uid[idx]] = u
        self.rebuild = True
        self.system.dae.factorize = True
        logger.debug('<Line> Status switch to {} on idx {}.'.format(u, idx))
391652
def switch(self, first, second):
        """"""
        allowed_states = ['queued', 'stashed']
        if first in self.queue and second in self.queue \
                and self.queue[first]['status'] in allowed_states\
                and self.queue[second]['status'] in allowed_states:

            tmp = self.queue[second].copy()
            self.queue[second] = self.queue[first].copy()
            self.queue[first] = tmp
            self.write()
            return True
        return False