/*
(non-Javadoc)
@see PhoneNumberProvisioningManager#cancelNumber(java.lang.String)
975522
@Override
    public boolean cancelNumber(PhoneNumber phoneNumberObj) {
        String phoneNumber = phoneNumberObj.getPhoneNumber();
        String numberToRemoveFromVi = phoneNumber;
        if(numberToRemoveFromVi.startsWith("+1")){
            numberToRemoveFromVi = numberToRemoveFromVi.replaceFirst("\\+1", "");
        }
        phoneNumber = numberToRemoveFromVi;

        if (!isValidDid(phoneNumber))
            return false;

        if (phoneNumber != null && !phoneNumber.isEmpty()) {
            final StringBuilder buffer = new StringBuilder();
            buffer.append("<request id=\""+generateId()+"\">");
            buffer.append(header);
            buffer.append("<body>");
            buffer.append("<requesttype>").append("releaseDID").append("</requesttype>");
            buffer.append("<item>");
            buffer.append("<did>").append(phoneNumber).append("</did>");
            buffer.append("</item>");
            buffer.append("</body>");
            buffer.append("</request>");
            final String body = buffer.toString();
            final HttpPost post = new HttpPost(uri);
            try {
                List<NameValuePair> parameters = new ArrayList<NameValuePair>();
                parameters.add(new BasicNameValuePair("apidata", body));
                post.setEntity(new UrlEncodedFormEntity(parameters));
                final DefaultHttpClient client = new DefaultHttpClient();
                if(telestaxProxyEnabled) {
                    addTelestaxProxyHeaders(post, ProvisionProvider.REQUEST_TYPE.RELEASEDID.name());
                }
                final HttpResponse response = client.execute(post);
                if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                    final String content = StringUtils.toString(response.getEntity().getContent());
                    if (content.contains("<statuscode>100</statuscode>")) {
                        return true;
                    }
                }
            } catch (final Exception ignored) {
            }
        }
        return false;
    }
1195504
void cancel(AsyncChannelFuture future, Exception reason) throws ClosedChannelException, IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "cancel");
        }
        if (!isOpen()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Cancel request on closed connection");
            }
            future.setCancelInProgress(0);
            throw new ClosedChannelException();
        }

        // Cannot cancel a completed call.
        if (future.isCompleted()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Cancel request on completed future");
            }
            future.setCancelInProgress(0);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                Tr.exit(tc, "cancel");
            }
            return;
        }

        long callid;
        if (((AsyncFuture) future).isRead()) {
            callid = this.readIOCB.getCallIdentifier();
        } else {
            callid = this.writeIOCB.getCallIdentifier();
        }

        int rc = provider.cancel2(this.channelIdentifier, callid);
        if (rc == 0) {
            // Mark the future completed with an Exception
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Cancel Successful, resetting CancelInProgress state to 0");
            }
            future.setCancelInProgress(0);
            future.completed(reason);
        } else {
            // could not cancel
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Cancel could not be completed");
            }
            future.setCancelInProgress(0);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "cancel");
        }
    }
953652
public Exception cancel(Exception error) {
		cancelled = true;
		if (error != null) {
			this.error = error;
		}
		return error;
	}
1286223
public Retryer<R> stopAfterAttempt(final int maxAttemptNumber) {
        checkArgument(maxAttemptNumber >= 1, "maxAttemptNumber must be >= 1 but is %d", maxAttemptNumber);
        return withStopStrategy(new StopStrategy() {
            
            @Override public boolean shouldStop(int previousAttemptNumber, long delaySinceFirstAttemptInMillis) {
                return previousAttemptNumber >= maxAttemptNumber;
            }
        });
    }
475942
public void setOrderedPhoneNumbers(java.util.Collection<OrderedPhoneNumber> orderedPhoneNumbers) {
        if (orderedPhoneNumbers == null) {
            this.orderedPhoneNumbers = null;
            return;
        }

        this.orderedPhoneNumbers = new java.util.ArrayList<OrderedPhoneNumber>(orderedPhoneNumbers);
    }
695159
@Override
    public boolean cancel(boolean mayInterruptIfRunning) {
        if (RESULT_UPDATER.compareAndSet(this, null, CANCELLATION_CAUSE_HOLDER)) {
            if (checkNotifyWaiters()) {
                notifyListeners();
            }
            return true;
        }
        return false;
    }
256141
public final void cancel(CancelException reason) {
		if (cancelling != null)
			return;
		if (reason == null) reason = new CancelException("No reason given");
		cancelling = reason;
		if (TaskScheduler.cancel(this)) {
			status = Task.STATUS_DONE;
			result.cancelled(reason);
			return;
		}
		if (manager.remove(this)) {
			status = Task.STATUS_DONE;
			result.cancelled(reason);
			return;
		}
		if (status == Task.STATUS_NOT_STARTED) {
			status = Task.STATUS_DONE;
			result.cancelled(reason);
			return;
		}
	}
932836
public void cancel(ScheduledFuture<?> scheduledFuture) {
        clear();
        if (scheduledFuture != null && !scheduledFuture.isDone()) {
            scheduledFuture.cancel(false);
        }
    }
1001501
@Programmatic
    public PhoneOrFaxNumber findByPhoneOrFaxNumber(
            final Object owner,
            final String phoneNumber) {

        final Optional<PhoneOrFaxNumber> phoneNumberIfFound = findByPhoneOrFaxNumber(owner, phoneNumber, CommunicationChannelType.PHONE_NUMBER);
        if(phoneNumberIfFound.isPresent()) {
            return phoneNumberIfFound.get();
        }

        final Optional<PhoneOrFaxNumber> faxNumberIfFound = findByPhoneOrFaxNumber(owner, phoneNumber, CommunicationChannelType.FAX_NUMBER);
        return faxNumberIfFound.orNull();
    }
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();
            }
        }
    }
152913
public void unsetAsynchConsumerCallback(int requestNumber, boolean stoppable)                        //SIB0115d.comms
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unsetAsynchConsumerCallback", "requestNumber="+requestNumber);

      try
      {
         if (stoppable) {                                                                               //SIB0115d.comms
           getConsumerSession().deregisterStoppableAsynchConsumerCallback();                            //SIB0115d.comms
         } else {                                                                                       //SIB0115d.comms
           getConsumerSession().deregisterAsynchConsumerCallback();
         }                                                                                              //SIB0115d.comms

         try
         {
            getConversation().send(poolManager.allocate(),
                                   JFapChannelConstants.SEG_DEREGISTER_ASYNC_CONSUMER_R,
                                   requestNumber,
                                   getLowestPriority(),
                                   true,
                                   ThrottlingPolicy.BLOCK_THREAD,
                                   null);
         }
         catch (SIException e)
         {
            FFDCFilter.processException(e,
                                        CLASS_NAME + ".unsetAsynchConsumerCallback",
                                        CommsConstants.CATCONSUMER_UNSETASYNCHCALLBACK_01,
                                        this);

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e);

            SibTr.error(tc, "COMMUNICATION_ERROR_SICO2013", e);
         }
      }
      catch (SIException e)
      {
         //No FFDC code needed
         //Only FFDC if we haven't received a meTerminated event.
         if(!((ConversationState)getConversation().getAttachment()).hasMETerminated())
         {
            FFDCFilter.processException(e,
                                        CLASS_NAME + ".unsetAsynchConsumerCallback",
                                        CommsConstants.CATCONSUMER_UNSETASYNCHCALLBACK_02,
                                        this);
         }

         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e);

         StaticCATHelper.sendExceptionToClient(e,
                                               CommsConstants.CATCONSUMER_UNSETASYNCHCALLBACK_02,
                                               getConversation(), requestNumber);
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unsetAsynchConsumerCallback");
   }
407758
@Override
  public boolean cancelOrder(String orderId) throws IOException {

    String[] pairAndId = orderId.split(":");

    mercadoBitcoinCancelOrder(pairAndId[0], pairAndId[1]);

    return true;
  }
545169
private void cancelAppendTimer() {
    if (appendTimer != null) {
      LOGGER.trace("{} - Cancelling append timer", context.getCluster().member().address());
      appendTimer.cancel();
    }
  }
553065
@Override
  public void cancel(Serializable id) {
    logger.debug("Cancelling timer with id {}", id);
    this.ftScheduler.cancel(id);
  }
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;
    }
573917
@Override
    protected void cancelFaxJobImpl(FaxJob faxJob)
    {
        //get fax job ID
        int faxJobIDInt=WindowsFaxClientSpiHelper.getFaxJobID(faxJob);

        //invoke fax action
        this.winCancelFaxJob(this.faxServerName,faxJobIDInt);
    }
1177181
function cancel(opt_reason) {
    if (!isPending()) {
      return;
    }

    if (opt_canceller) {
      opt_reason = opt_canceller(opt_reason) || opt_reason;
    }

    reject(opt_reason);
  }