/*
(non-Javadoc)

@see org.jdiameter.common.api.timer.ITimerFacility#cancel(java.io.Serializable)
553065
@Override
  public void cancel(Serializable id) {
    logger.debug("Cancelling timer with id {}", id);
    this.ftScheduler.cancel(id);
  }
137661
public void cancel(final String eventName) {

        BurstEvent oe = m_memory.remove(eventName);
        if (oe != null) {
            // disable the old event.
            oe.getTimer().cancel();
        }
    }
906908
public void stopTimer() {
		if(this.WRITE_CACHE_ENABLED) {
			if(timerWriteCache != null) {
				timerWriteCache.cancel();
			}
			if(writeTimer != null){
				writeTimer.cancel();
			}
			if(timerDeleteCache != null) {
				timerDeleteCache.cancel();
			}
			if(deleteTimer != null){
				deleteTimer.cancel();
			}
		}
	}
1329008
@Override
    public boolean cancel() {
        if (Config.DEBUG) {
            Log.v(TAG, "cancel() " + getName());
        }
        return mInfo.queue.cancel(getName());
    }
508538
public synchronized void cancel() {
    for (int taskId : mJobInfo.getTaskIdList()) {
      mCommandManager.submitCancelTaskCommand(mJobInfo.getId(), taskId,
          mTaskIdToWorkerInfo.get(taskId).getId());
    }
  }
1225044
public void cancel() {
        if(actionInBackground != null) {
            if(executorService != null) {
               asyncFutureTask.cancel(true);
            } else {
                asyncThread.interrupt();
            }
        }
    }
219082
void cancelEdit() {

        // store the scroll position
        int scrollTop = RootPanel.getBodyElement().getOwnerDocument().getScrollTop();
        setEditorState(false);
        unlockResource();
        if (m_onClose != null) {
            m_onClose.execute(Boolean.valueOf(m_hasChangedSettings));
        }
        destroyForm(true);
        clearEditor();
        // restore the scroll position
        RootPanel.getBodyElement().getOwnerDocument().setScrollTop(scrollTop);
    }
542939
protected void cancelAlarms() {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "cancelAlarms");

        if (_timeout > 0) {
            TimeoutManager.setTimeout(this, TimeoutManager.CANCEL_TIMEOUT, 0);
            _timeout = 0;
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "cancelAlarms");
    }
1178788
public function cancel()
    {
        $this->cb = null;
        $this->context = null;
        if ($this->timer !== null) {
            Timer::remove($this->timer);
            $this->timer = null;
        }
    }
1249237
def cancel(self):
        """"""
        if self.__process.is_alive():
            self.__process.terminate()

        _raise_exception(self.__timeout_exception, self.__exception_message)
946767
@Weight(Weight.Unit.NORMAL)
  public static void cancelAll() {
    final List<TimeData> list = REGISTRY.get();
    list.clear();
    REGISTRY.remove();
  }
1138981
public final void setCancelable(final Cancelable cancelable) {
        if (SwingUtilities.isEventDispatchThread()) {
            setCancelableIntern(cancelable);
        } else {
            try {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        setCancelableIntern(cancelable);
                    }
                });
            } catch (final Exception ex) {
                ignore();
            }
        }
    }
157440
public void cancel() { //d583637, F73234
        synchronized (ivCancelLock) { //d601399
            ivIsCanceled = true;
            if (ivScheduledFuture != null)
                ivScheduledFuture.cancel(false);
            ivCache = null;
            ivElements = null;
        }
    }
195043
public void cancel() {
        try {
            // FileOutputStream is also closed cascadingly
            if (outStream != null) {
                outStream.close();
                outStream = null;
            }
            // Clear encryptor:
            encryptor = null;
        } catch (IOException e) {
            Log.w(Log.TAG_BLOB_STORE, "Exception closing buffered output stream", e);
        }
        tempFile.delete();
    }
1039227
public void cancel(TimerTask task) {
        //CANCEL needs to remove the shceduled timer see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6602600
        //to improve perf

        ScheduledFuture<?> future = null;
        Object[] array = super.getQueue().toArray();
        for(int i = 0; i<array.length; i++) {
            if(array[i] instanceof ScheduledFuture<?>){
                future = (ScheduledFuture<?>)array[i];
                try {

                    Field callableField = future.getClass().getDeclaredField("callable");
                    callableField.setAccessible(true);
                    Object callable = callableField.get(future);
                    callableField.setAccessible(false);

                    if(callable!=null){
                        Field taskField = callable.getClass().getDeclaredField("task");
                        taskField.setAccessible(true);
                        TimerTask scheduledTask = null;
                        if(taskField.get(callable) instanceof TimerTask){
                             scheduledTask = (TimerTask) taskField.get(callable);
                        }
                        taskField.setAccessible(false);

                        if(scheduledTask!=null && scheduledTask.equals(task)){
                            break;
                        }
                    }
                } catch (Exception e) {
                    logger.warn("Couldn't clean the timer from the JVM GC ", e);
                }
            }
        }

        if(future != null) {
            boolean removed = super.remove((Runnable) future);
            if(logger.isDebugEnabled()) {
                logger.debug("expiration timer on sip proxy task" + task + " removed : " + removed);
            }
            boolean cancelled = future.cancel(true);
            if(logger.isDebugEnabled()) {
                logger.debug("expiration timer on sip proxy task" + task + " Cancelled : " + cancelled);
            }

            future = null;
            // Purge is expensive when called frequently, only call it every now and then.
            // We do not sync the numCancelled variable. We dont care about correctness of
            // the number, and we will still call purge rought once on every 25 cancels.
            numCancelled++;
            if(numCancelled % 100 == 0) {
                super.purge();
            }
        } else {
            if(logger.isDebugEnabled()) {
                logger.debug("expiration timer future is null, thus cannot be Cancelled");
            }
        }
    }
45768
public void cancel() {

    this.stateLock.lock();

    try {

      if (this.state == RunnableProcessState.RUNNING) {
        this.process.destroy();
        if (!this.doneCond.await(DESTROY_WAIT_TIME, TimeUnit.MILLISECONDS)) {
          LOG.log(Level.FINE, "{0} milliseconds elapsed", DESTROY_WAIT_TIME);
        }
      }

      if (this.state == RunnableProcessState.RUNNING) {
        LOG.log(Level.WARNING, "The child process survived Process.destroy()");
        if (OSUtils.isUnix() || OSUtils.isWindows()) {
          LOG.log(Level.WARNING, "Attempting to kill the process via the kill command line");
          try {
            final long pid = readPID();
            OSUtils.kill(pid);
          } catch (final IOException | InterruptedException | NumberFormatException e) {
            LOG.log(Level.SEVERE, "Unable to kill the process.", e);
          }
        }
      }

    } catch (final InterruptedException ex) {
      LOG.log(Level.SEVERE,
          "Interrupted while waiting for the process \"{0}\" to complete. Exception: {1}",
          new Object[] {this.id, ex});
    } finally {
      this.stateLock.unlock();
    }
  }
1372556
@Override
    public boolean cancel(boolean ignored) {
        boolean cancelled = false;
        if (latch.getCount() == 1) {
            latch.countDown();
            output = null;
            cancelled = true;
        }
        return cancelled;
    }