/*
@see com.ibm.io.async.IAsyncProvider#cancel2(long, long)
338672
@Override
    public int cancel2(long channelId, long callId) throws AsyncException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "cancel2: channel = " + channelId + " call id = " + callId);
        }
        int rc = 0;
        synchronized (oneAtATime) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "have lock");
            }
            if (aioInitialized == AIO_INITIALIZED) {
                try {
                    // Ask the native code to perform a cancel operation
                    rc = aio_cancel2(channelId, callId);
                } catch (Throwable t) {
                    if (aioInitialized != AIO_SHUTDOWN) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "caught throwable:" + t);
                        }
                        throw new AsyncException("Throwable caught from aio dll: aio_cancel2: " + t.getMessage());
                    }
                }
            }
        } // end-sync
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "cancel2: " + rc);
        }
        return rc;
    }
1287012
protected void sendExit2(final OtpErlangPid from, final OtpErlangPid dest,
            final OtpErlangObject reason) throws IOException {
        sendExit(exit2Tag, from, dest, reason);
    }
971038
private static RuntimeException cancelThrow(ClientCall<?, ?> call, Throwable t) {
    try {
      call.cancel(null, t);
    } catch (Throwable e) {
      assert e instanceof RuntimeException || e instanceof Error;
      logger.log(Level.SEVERE, "RuntimeException encountered while closing call", e);
    }
    if (t instanceof RuntimeException) {
      throw (RuntimeException) t;
    } else if (t instanceof Error) {
      throw (Error) t;
    }
    // should be impossible
    throw new AssertionError(t);
  }
443929
@Override
    public boolean cancel(boolean mayInterruptIfRunning) {
        boolean canceled = super.cancel(mayInterruptIfRunning);
        if (canceled) {
            ((AbstractScheduledEventExecutor) executor()).removeScheduled(this);
        }
        return canceled;
    }
207547
void cancel() {
        connection.removeConnectionListener(connListener);
        ((ObservableReader) reader).removeReaderListener(readerListener);
        ((ObservableWriter) writer).removeWriterListener(writerListener);
        messagesTable = null;
    }
174851
public void cancel(final String msg) {
    JobState js = msg == null ? JobState.CANCELLED : JobState.FAILED;
    cancel(msg, js);
  }
817167
public static void suspend(long intervalAsMillis,
            Supplier<Boolean> suspendConditionSupplier) {
        if (!suspendConditionSupplier.get())
            return;
        log.warn("Start Suspending !!!");
        long startTimeMillis = System.currentTimeMillis();
        while (suspendConditionSupplier.get())
            sleep(intervalAsMillis);
        log.warn("Stop Suspending Over {} ms",
                System.currentTimeMillis() - startTimeMillis);
    }
152947
public synchronized void stop(String J2EEName) {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[STOP]);
        }

        decrementRefCount();
        if (this._refCount > 0) {
            if (_sap.getAppName() == "GLOBAL_HTTP_SESSION_CONTEXT") { // only call if global context
                stopListeners(J2EEName); // for global sessions, might have to stop some
                // listeners...
            }
            // shared sessions -- another app is still using this SessionContext
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[STOP], "Reference count is not zero, so returning without stopping");
            }
            return;
        }

        String coreManagerId = _coreHttpSessionManager.getID();
        // invalidateAllMemorySessions for in memory, and writes out sessions not
        // written out and passivates for persistent cases
        _coreHttpSessionManager.getIStore().stop();
        if (_coreHttpAppSessionManager != null) {
            // done above - boolean cleanUpAppSessionManager =
            // ((ApplicationSessionManager)_coreHttpAppSessionManager).removeSessionManager(_coreHttpSessionManager.getID());
            // REG - might want to move it back up
            // we need to remove the session manager so we don't try to access the
            // session while stopping
            cleanUpAppSessionManager(coreManagerId, J2EEName);
        }

        _invalidator.stop(); // stop invalidator thread
        if (_storer instanceof ITimer) { // stop tbw thread
            ((ITimer) _storer).stop();
        }

        String appName = _sap.getAppName();
        SessionContextRegistry.remove(appName);
        // need to update the SessionManagerRegistry to free up memory
        SessionManagerRegistry.getSessionManagerRegistry().unregisterSessionManager(appName);

        SessionManager removedSessionManager = SessionManager.removeSessionManager(appName);
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINEST)) {
            LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINEST, methodClassName, methodNames[STOP], "Removed session manager: " + removedSessionManager);
        }

        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[STOP]);
        }
    }
619604
public static void writeS2(OutputStream dest, int s2) throws IOException {
        if ((s2 < Short.MIN_VALUE) || (s2 > Short.MAX_VALUE)) {
            throw new IllegalArgumentException();
        }
        dest.write((byte) (s2 >> 8));
        dest.write((byte) s2);
    }
1032160
@Override
  public boolean cancel(final boolean mayInterruptIfRunning) {
    try {
      return cancel(mayInterruptIfRunning, Optional.<Long>empty(), Optional.<TimeUnit>empty());
    } catch (final TimeoutException e) {
      // This should never happen.
      LOG.log(Level.WARNING, "Received a TimeoutException in VortexFuture.cancel(). Should not have occurred.");
      return false;
    }
  }
1127132
@Override
    public boolean cancel(boolean mayInterruptIfRunning) {
        if (!isInitialized()) {
            return internalFuture.cancel(mayInterruptIfRunning);
        }
        return synchronisationFuture.cancel(mayInterruptIfRunning) && internalFuture.cancel(mayInterruptIfRunning);
    }
1133852
public static long[] clearI(long[] v, int off) {
    final int wordindex = off >>> LONG_LOG2_SIZE;
    v[wordindex] &= ~(1L << off);
    return v;
  }
89287
@Override
    public boolean cancel(boolean mayInterruptIfRunning) {

        if (m_isDone == true) {
            return false;
        }
        m_isDone = true;

        try {
            m_cancelResult = m_schedFuture.cancel(mayInterruptIfRunning);

            m_pendingException = new CancellationException();
        } finally {
            // Let get() finish
            this.m_coordinationLatch.countDown();
        }

        return m_cancelResult;
    }
1144212
public synchronized int cancelByTag(String tagToCancel) {
        int i = 0;
        if (taskList.containsKey(tagToCancel)) {
            removeDoneTasks();

            for (Future<BlurWorker.Result> future : taskList.get(tagToCancel)) {
                BuilderUtil.logVerbose(Dali.getConfig().logTag, "Canceling task with tag " + tagToCancel, Dali.getConfig().debugMode);
                future.cancel(true);
                i++;
            }

            //remove all canceled tasks
            Iterator<Future<BlurWorker.Result>> iter = taskList.get(tagToCancel).iterator();
            while (iter.hasNext()) {
                if (iter.next().isCancelled()) {
                    iter.remove();
                }
            }
        }
        return i;
    }
1134795
@Override
    public boolean cancel(final String appName, final String id,
                          final boolean isReplication) {
        if (super.cancel(appName, id, isReplication)) {
            replicateToPeers(Action.Cancel, appName, id, null, null, isReplication);
            synchronized (lock) {
                if (this.expectedNumberOfClientsSendingRenews > 0) {
                    // Since the client wants to cancel it, reduce the number of clients to send renews
                    this.expectedNumberOfClientsSendingRenews = this.expectedNumberOfClientsSendingRenews - 1;
                    updateRenewsPerMinThreshold();
                }
            }
            return true;
        }
        return false;
    }
372673
protected void validateLong(int index, long min, long max, String errorKey, String errorMessage) {
		String value = controller.getPara(index);
		if (value != null && (value.startsWith("N") || value.startsWith("n"))) {
			value = "-" + value.substring(1);
		}
		validateLongValue(value, min, max, errorKey, errorMessage);
	}
10336
public void cancelTimer(IPollEvents sink, int id)
    {
        assert (Thread.currentThread() == worker);

        TimerInfo copy = new TimerInfo(sink, id);
        //  Complexity of this operation is O(n). We assume it is rarely used.

        TimerInfo timerInfo = timers.find(copy);
        if (timerInfo != null) {
            // let's defer the removal during the loop
            timerInfo.cancelled = true;
        }
    }