Cancels all tasks of the specified group w/ the specified reason.

@param context used to interact with the service
@param id the value to cancel
@param cancelListener callback for cancel result
513275
public static void cancelTaskById(Context context, final long id, final int reason,
      final SingleCancelListener cancelListener,
      Class<? extends GroundyService> groundyServiceClass) {
    if (id <= 0) {
      throw new IllegalStateException("id must be greater than zero");
    }
    new GroundyServiceConnection(context, groundyServiceClass) {
      @Override
      protected void onGroundyServiceBound(GroundyService.GroundyServiceBinder binder) {
        int result = binder.cancelTaskById(id, reason);
        if (cancelListener != null) {
          cancelListener.onCancelResult(id, result);
        }
      }
    }.start();
  }
242755
public void deactivate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(this, tc, "Deactivating");
        }
        if (null != this.future) {
            synchronized (this.timerLock) {
                if (null != this.future) {
                    this.future.cancel(true);
                    this.future = null;
                }
            } // end-sync
        }
        // TODO purge the groupings/sessions maps, or dump to disk once
        // persistence is added
    }
544290
public void deactivate(ComponentContext context) {
        if (contextRef.get() == null) {
            // Components are only deactivated if they activate successfully,
            // and component instances are discarded after being deactivated.
            // This is either DS or programmer error.
            throw new IllegalStateException("not activated");
        }

        this.contextRef.set(null);
    }
861434
@RequiresPermission(allOf = {Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH})
	public final void stopScan(@NonNull final Context context,
							   @NonNull final PendingIntent callbackIntent) {
		//noinspection ConstantConditions
		if (callbackIntent == null) {
			throw new IllegalArgumentException("callbackIntent is null");
		}
		//noinspection ConstantConditions
		if (context == null) {
			throw new IllegalArgumentException("context is null");
		}
		stopScanInternal(context, callbackIntent);
	}
82769
def delete(context, id):
    
    result = component.delete(context, id=id)
    if result.status_code == 204:
        utils.print_json({'id': id, 'message': 'Component deleted.'})
    else:
        utils.format_output(result, context.format)
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);
  }
863475
@Override
    public void stop(BundleContext context) throws Exception {
        app.fire(new Stop(), Channel.BROADCAST);
        Components.awaitExhaustion();
    }
956185
@Override
    public void dismiss(int id) {
        if (restartables.get(id) != null)
            restartables.get(id).dismiss();
    }
392140
public synchronized void notifyTaskCancellation(long jobId, int taskId) {
    Pair<Long, Integer> id = new Pair<>(jobId, taskId);
    TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id);
    taskInfo.setStatus(Status.CANCELED);
    finishTask(id);
    LOG.info("Task {} for job {} canceled", taskId, jobId);
  }
1022137
protected void deactivate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            Tr.event(this, tc, "deactivate", context);
        configAdminRef.deactivate(context);
        variableRegistryRef.deactivate(context);
        metaTypeServiceRef.deactivate(context);
        wsConfigurationHelperRef.deactivate(context);
    }
512556
@Override
	public void stop(BundleContext context) throws Exception {
		final String sourceMethod = "stop"; //$NON-NLS-1$
		boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(Activator.class.getName(), sourceMethod, new Object[]{context});
		}
		super.stop(context);
		// Shutdown the aggregator instances
		ServiceReference<?>[] refs = context.getServiceReferences(IAggregator.class.getName(), null);
		if (refs != null) {
			for (ServiceReference<?> ref : refs) {
				AggregatorImpl aggr = (AggregatorImpl)context.getService(ref);
				if (aggr != null) {
					try {
						aggr.shutdown();
					} catch (Exception e) {
						if (log.isLoggable(Level.SEVERE)) {
							log.log(Level.SEVERE, e.getMessage(), e);
						}
					}
				}
			}
		}

		for (ServiceRegistration<?> reg : serviceRegistrations) {
			reg.unregister();
		}
		if (executors != null) {
			executors.shutdown();
		}
		this.executors = null;
		Activator.context = null;

		if (isTraceLogging) {
			log.exiting(Activator.class.getName(), sourceMethod);
		}
	}
37050
public static void register(Context context, int id) {
        register(context, context.getResources().getResourceName(id));
    }
840844
@Override
    public void cancelAllScheduledForActor() {
	final Set<ActionContext<T>> toCancel;
	synchronized (contexts) {
	    toCancel = new HashSet<>(contexts);
	    contexts.clear();
	}

	// Cancel all
	toCancel.forEach(cxt -> {
	    if (!cxt.isDone()) {
		cxt.cancel();
	    }
	});
    }
1203269
public static synchronized void cancel(TimerTask task) {
        if (task == null) {
            return;
        }
        task.cancel();
        usageCount.decrementAndGet();
        if (usageCount.get() == 0) {
            timer.cancel();
            timer = null;
        }
    }
189996
public void cancel(long id) {

		// Lookup the background call for the given id.
		Caller cancel = backgroundCalls.get(id);
		if(cancel == null) {
			return;
		}

		// Cancel the thread
		cancel.cancel();

		try {
			// Wait for the thread
			cancel.join();
		} catch (InterruptedException ex) {
			// Ignore this
		}

	}
725529
@Deactivate
    protected void deactivate(ComponentContext context) {
        lock.writeLock().lock();
        try {
            componentContext = null;
            properties = null;
            threadContextConfigurations = null;
        } finally {
            lock.writeLock().unlock();
        }
    }
1350715
@Deactivate
    protected void deactivate(ComponentContext context) {
        SibTr.entry(tc, CLASS_NAME + "deactivate", context);

        runtimeSecurityService.modifyMessagingServices(null);
        queuePermissions = null;
        topicPermissions = null;
        temporaryDestinationPermissions = null;
        sibAuthenticationService = null;
        sibAuthorizationService = null;
        this.bundleLocation = null;
        
        SibTr.exit(tc, CLASS_NAME + "deactivate");
    }