If the call is currently being executed or sent for remote
           execution, then it cannot be cancelled and the method will return
           False, otherwise the call will be cancelled and the method will
           return True.
767509
def cancel(self):
        """"""
        if self in scoop._control.execQueue.movable:
            self.exceptionValue = CancelledError()
            scoop._control.futureDict[self.id]._delete()
            scoop._control.execQueue.remove(self)
            return True
        return False
776945
private boolean cancelRequestInternal(
    AORequestedTick requestedTick,
    boolean expiry)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "cancelRequestInternal",
        new Object[] { requestedTick, Boolean.valueOf(expiry)});

    // cancel the timer only if !expiry, since expiry implies timer has already occured.
    boolean transitionOccured = requestedTick.expire(!expiry);
    if (transitionOccured)
    { // successfully expired
      listOfRequests.remove(requestedTick);
      tableOfRequests.remove(requestedTick.objTick);

      // start the idle timer if no element left in listOfRequests
      // and set isready to false
      if (listOfRequests.isEmpty())
      {
        if (idleTimeout > 0)
          this.idleHandler = am.create(idleTimeout, this);
        if (isready)
        {
          isready = false;
          ck.notReady();
        }
      }
    } // end if (transitionOccured)

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "cancelRequestInternal", Boolean.valueOf(transitionOccured));

    return transitionOccured;
  }
1206455
private void cancelInvokable(AbstractInvokable invokable) {
		// in case of an exception during execution, we still call "cancel()" on the task
		if (invokable != null && invokableHasBeenCanceled.compareAndSet(false, true)) {
			try {
				invokable.cancel();
			}
			catch (Throwable t) {
				LOG.error("Error while canceling task {}.", taskNameWithSubtask, t);
			}
		}
	}
437055
public boolean cancel(final boolean mayInterruptIfRunning, final long timeout, final TimeUnit unit)
      throws TimeoutException {
    return cancel(mayInterruptIfRunning, Optional.of(timeout), Optional.of(unit));
  }
658019
private boolean checkReceiveAllowed() throws SISessionUnavailableException, SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "checkReceiveAllowed");

        boolean allowed = _destinationAttachedTo.isReceiveAllowed();

        if (!allowed)
        {
            // Register that LCP stopped for Receive Allowed
            _stoppedForReceiveAllowed = true;

            // Stop LCP for Receive Allowed
            if (!_stopped)
            {
                internalStop();
            }
        }
        else
        {
            // Register that LCP not stopped for Receive Allowed
            _stoppedForReceiveAllowed = false;

            // Start LCP if no reason to be stopped
            if ((_stopped)
                && (!_stoppedByRequest))
            {
                internalStart(false);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "checkReceiveAllowed", Boolean.valueOf(allowed));

        return allowed;
    }
1040417
@Override
    public boolean isCancelled() {

        //F743-609CodRev - read volatile variable only once
        boolean cancelled = ivCancelled;

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "isCancelled: " + cancelled + " Future object: " + this);
        }

        return (cancelled);
    }
1319595
public boolean check() {
        if (!method.getReturnType().equals(Void.TYPE)) {
            WebSocketRouter.getLogger().error("The method {} annotated with a web socket callback is not well-formed. " +
                            "These methods receive only parameter annotated with @Parameter and do not return anything",
                    method.getName()
            );
            return false;
        }

        List<ActionParameter> localArguments = buildArguments(method);
        if (localArguments == null) {
            return false;
        } else {
            this.arguments = localArguments;
            return true;
        }
    }
1176262
final boolean abort() {
        if (!taken.get()) {
            // aborting always runs before connection
            // happens. If we reach this point the request
            // can be active or suspended
            // but nor delivered or committed
            result = BaasResult.cancel();
            // we can simply forcefully set the value
            // to ABORTED to let the resource been cleaned up
            suspendableHandler.set(Signal.ABORTED);
            finish();
            return true;
        }
        return false;
    }
918339
def _can_callback(self, irs):
        
        for ir in irs:
            if isinstance(ir, LowLevelCall):
                return True
            if isinstance(ir, HighLevelCall) and not isinstance(ir, LibraryCall):
                # If solidity >0.5, STATICCALL is used
                if self.slither.solc_version and self.slither.solc_version.startswith('0.5.'):
                    if isinstance(ir.function, Function) and (ir.function.view or ir.function.pure):
                        continue
                    if isinstance(ir.function, Variable):
                        continue
                # If there is a call to itself
                # We can check that the function called is
                # reentrancy-safe
                if ir.destination == SolidityVariable('this'):
                    if isinstance(ir.function, Variable):
                        continue
                    if not ir.function.all_high_level_calls():
                        if not ir.function.all_low_level_calls():
                            continue
                return True
        return False
1362691
private static <T> void retryOperation(
			final CompletableFuture<T> resultFuture,
			final Supplier<CompletableFuture<T>> operation,
			final int retries,
			final Executor executor) {

		if (!resultFuture.isDone()) {
			final CompletableFuture<T> operationFuture = operation.get();

			operationFuture.whenCompleteAsync(
				(t, throwable) -> {
					if (throwable != null) {
						if (throwable instanceof CancellationException) {
							resultFuture.completeExceptionally(new RetryException("Operation future was cancelled.", throwable));
						} else {
							if (retries > 0) {
								retryOperation(
									resultFuture,
									operation,
									retries - 1,
									executor);
							} else {
								resultFuture.completeExceptionally(new RetryException("Could not complete the operation. Number of retries " +
									"has been exhausted.", throwable));
							}
						}
					} else {
						resultFuture.complete(t);
					}
				},
				executor);

			resultFuture.whenComplete(
				(t, throwable) -> operationFuture.cancel(false));
		}
	}
401118
private boolean isRetryable(SdkBaseException e) {
        if (e.getCause() instanceof IOException) {
            return true;
        } else if (e instanceof HttpException) {
            // Only retry on 500s.
            return ((HttpException) e).getStatusCode() / 100 == 5;
        } else {
            return false;
        }
    }
106109
public void checkCanceled(final ResourceSet rs) {
    if ((rs instanceof XtextResourceSet)) {
      if ((((XtextResourceSet)rs).isOutdated() && (this.cancelationAllowed.get()).booleanValue())) {
        this.canceledManager.throwOperationCanceledException();
      }
    }
  }
1292262
def cancel(self):
        
        if self.done():
            return False

        self._client.cancel_operation(self._operation.name)
        return True
1008187
public boolean setCancellerHandle(ScheduledFuture<?> cancellerHandle) {
		synchronized (lock) {
			if (this.cancellerHandle == null) {
				if (!discarded) {
					this.cancellerHandle = cancellerHandle;
					return true;
				} else {
					return false;
				}
			}
			else {
				throw new IllegalStateException("A canceller handle was already set");
			}
		}
	}
33867
private void sendCancelRpcCall(int numberRetries) {
		final LogicalSlot slot = assignedResource;

		if (slot != null) {
			final TaskManagerGateway taskManagerGateway = slot.getTaskManagerGateway();
			final ComponentMainThreadExecutor jobMasterMainThreadExecutor =
				getVertex().getExecutionGraph().getJobMasterMainThreadExecutor();

			CompletableFuture<Acknowledge> cancelResultFuture = FutureUtils.retry(
				() -> taskManagerGateway.cancelTask(attemptId, rpcTimeout),
				numberRetries,
				jobMasterMainThreadExecutor);

			cancelResultFuture.whenComplete(
				(ack, failure) -> {
					if (failure != null) {
						fail(new Exception("Task could not be canceled.", failure));
					}
				});
		}
	}
389363
public boolean isSmResumptionPossible() {
        // There is no resumable stream available
        if (smSessionId == null)
            return false;

        final Long shutdownTimestamp = packetWriter.shutdownTimestamp;
        // Seems like we are already reconnected, report true
        if (shutdownTimestamp == null) {
            return true;
        }

        // See if resumption time is over
        long current = System.currentTimeMillis();
        long maxResumptionMillies = ((long) getMaxSmResumptionTime()) * 1000;
        if (current > shutdownTimestamp + maxResumptionMillies) {
            // Stream resumption is *not* possible if the current timestamp is greater then the greatest timestamp where
            // resumption is possible
            return false;
        } else {
            return true;
        }
    }
1150754
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1975")
  public static Status statusFromCancelled(Context context) {
    Preconditions.checkNotNull(context, "context must not be null");
    if (!context.isCancelled()) {
      return null;
    }

    Throwable cancellationCause = context.cancellationCause();
    if (cancellationCause == null) {
      return Status.CANCELLED.withDescription("io.grpc.Context was cancelled without error");
    }
    if (cancellationCause instanceof TimeoutException) {
      return Status.DEADLINE_EXCEEDED
          .withDescription(cancellationCause.getMessage())
          .withCause(cancellationCause);
    }
    Status status = Status.fromThrowable(cancellationCause);
    if (Status.Code.UNKNOWN.equals(status.getCode())
        && status.getCause() == cancellationCause) {
      // If fromThrowable could not determine a status, then
      // just return CANCELLED.
      return Status.CANCELLED.withDescription("Context cancelled").withCause(cancellationCause);
    }
    return status.withCause(cancellationCause);
  }