Stops the consumer. This call is delegated to the sub consumer if
one exists or the <code>CATConsumer</code> version is used.

@param requestNumber The request number which replies should be sent to.
774245
public void stop(int requestNumber)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "stop", requestNumber);

      // We need to lock this down with a semaphore here to ensure that the 'started' flag is
      // correct by callers of isStarted() - see defect 347591

      checkNotBrowserSession();
      
      SessionStopSendListener listener = new SessionStopSendListener();
      startSemaphore.waitOnIgnoringInterruptions();

      try {
          if (subConsumer != null)
          {
              subConsumer.stop(requestNumber, listener);
          }
          else
          {
              super.stop(requestNumber, listener);
          }
      }
      catch (RuntimeException e) {
          FFDCFilter.processException(e, CLASS_NAME + ".stop",
                                      CommsConstants.CATMAINCONSUMER_STOP_01, this,
                                      new Object[]{subConsumer});

         // the listener may never post because of this, so we post now
         // to ensure the semaphore is not left dangling
         listener.errorOccurred(e);
         if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "stop", e); 
         throw e;
      }
      
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "stop");
   }
547363
def on_iteration(self):
        
        self._cancel_consumers_if_requested()

        if len(self._consumers) == 0:
            _log.debug('requesting stop after iteration')
            self.should_stop = True
1238027
@Override
  public void stop() {
    cancellable.cancel();

    for (final SocketChannelSelectionProcessor processor : processors) {
      processor.close();
    }

    try {
      selector.close();
    } catch (Exception e) {
      logger().log("Failed to close selctor for: '" + name + "'", e);
    }

    try {
      channel.close();
    } catch (Exception e) {
      logger().log("Failed to close channel for: '" + name + "'", e);
    }

    super.stop();
  }
828708
public synchronized void remove(int requestId)
   {
		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "remove");
		
      if (!containsId(requestId))
      {
         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTraceTable("id ("+requestId+") not in table");
         throw new SIErrorException(nls.getFormattedMessage("REQIDTABLE_INTERNAL_SICJ0058", null, "REQIDTABLE_INTERNAL_SICJ0058")); // D226223
      }

      testReqIdTableEntry.requestId = requestId;
      table.remove(testReqIdTableEntry);

		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "remove");
   }
1086743
@Override
  public void stop() {
    cancellable.cancel();

    try {
      selector.close();
    } catch (Exception e) {
      logger().log("Failed to close selctor for " + name + " while stopping because: " + e.getMessage(), e);
    }
  }
356846
@Override
    public void removeReadyConsumer(JSConsumerKey consumerKey, boolean bSelector)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "removeReadyConsumer",
                        new Object[] { consumerKey, Boolean.valueOf(bSelector) });

        if (consumerKey == null)
        {
            SIErrorException e =
                            new SIErrorException(
                                            nls.getFormattedMessage(
                                                                    "INTERNAL_MESSAGING_ERROR_CWSIP0001",
                                                                    new Object[] {
                                                                                  "com.ibm.ws.sib.processor.impl.ConsumerDispatcher",
                                                                                  "1:1684:1.280.5.25" },
                                                                    null));

            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.ConsumerDispatcher.removeReadyConsumer",
                                        "1:1690:1.280.5.25",
                                        this);

            SibTr.exception(tc, e);

            SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
                        new Object[] {
                                      "com.ibm.ws.sib.processor.impl.ConsumerDispatcher",
                                      "1:1698:1.280.5.25" });

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "removeReadyConsumer", e);

            throw e;
        }

        if (consumerKey.getForwardScanning())
        {
            //remove the consumer point from the FS ready list
            ((SimpleEntry) consumerKey).remove();
        }
        else
        {
            if (bSelector)
            {
                //decrement the specific ready consumer counter
                specificReadyConsumerCount--;

                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc, "sepcificReadyConsumerCount:" + specificReadyConsumerCount);
            }
            else
            {
                //remove the consumer point from the ready list
                ((SimpleEntry) consumerKey).remove();
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "removeReadyConsumer");
    }
101765
@Override
    public void flush(int requestNumber) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "flush", "" + requestNumber);

        try {
            // Make sure it is stopped before we activate it
            if (mainConsumer.isStarted())
                getConsumerSession().stop();
            getConsumerSession().activateAsynchConsumer(true);
            if (mainConsumer.isStarted())
                getConsumerSession().start(false);

            short jfapPriority = JFapChannelConstants.getJFAPPriority(Integer.valueOf(mainConsumer.getLowestPriority())); // d172528
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "Sending with JFAP priority of " + jfapPriority); // d172528

            try {
                getConversation().send(poolManager.allocate(),
                                       JFapChannelConstants.SEG_FLUSH_SESS_R,
                                       requestNumber,
                                       jfapPriority,
                                       true,
                                       ThrottlingPolicy.BLOCK_THREAD,
                                       null);
            } catch (SIException e) {
                FFDCFilter.processException(e,
                                            CLASS_NAME + ".flush",
                                            CommsConstants.CATASYNCHCONSUMER_FLUSH_01,
                                            this);

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

                SibTr.error(tc, "COMMUNICATION_ERROR_SICO2017", 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 + ".flush",
                                            CommsConstants.CATASYNCHCONSUMER_FLUSH_02,
                                            this);
            }

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

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

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "flush");
    }
1283472
@Override
    public void close(int requestNumber) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "close", "" + requestNumber);

        BrowserSession browserSession = mainConsumer.getBrowserSession();
        try {
            browserSession.close();
        } 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 + ".close",
                                            CommsConstants.CATBROWSECONSUMER_CLOSE_01,
                                            this);
            }

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

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

        try {
            getConversation().send(poolManager.allocate(),
                                   JFapChannelConstants.SEG_CLOSE_CONSUMER_SESS_R,
                                   requestNumber,
                                   Conversation.PRIORITY_LOWEST,
                                   true,
                                   ThrottlingPolicy.BLOCK_THREAD,
                                   null);
        } catch (SIException e) {
            FFDCFilter.processException(e, CLASS_NAME + ".close",
                                        CommsConstants.CATBROWSECONSUMER_CLOSE_02,
                                        this);

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

            // Cannot do anything else at this point as a comms exception suggests that the
            // connection is unusable.
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "close");
    }
386635
public ApiResponse<ApiSuccessResponse> stopMonitoringWithHttpInfo(StopMonitoringData stopMonitoringData) throws ApiException {
        com.squareup.okhttp.Call call = stopMonitoringValidateBeforeCall(stopMonitoringData, null, null);
        Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
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");
   }
1253528
@RequestMapping(path = "/{customerId}", method = RequestMethod.DELETE)
    public ResponseEntity removeCustomer(@PathVariable("customerId") Long customerId){
        boolean succeed = customerService.removeCustomer(customerId);
        if(succeed){
            return new ResponseEntity(HttpStatus.OK);
        }else{
            return new ResponseEntity(HttpStatus.NOT_FOUND);
        }
    }
641137
public void cancelRequest(long ticketNumber) {
    if (this.session != null
        && this.outstandingRequests.containsKey(Long.valueOf(ticketNumber))) {
      CancelRequestMessage message = new CancelRequestMessage();
      message.setTicketNumber(ticketNumber);
      this.session.write(message);
    } else {
      log.warn("Tried to cancel unknown request for ticket number {}.",
          Long.valueOf(ticketNumber));
    }
  }
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;
    }
982869
public void unsetAsynchConsumer(boolean stoppable)                                                   //SIB0115d.comms
      throws SISessionUnavailableException, SISessionDroppedException,
             SIConnectionUnavailableException, SIConnectionDroppedException,
             SIErrorException,
             SIIncorrectCallException
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unsetAsynchConsumer");

      if (sessionId == 0)
      {
         // If the session Id = 0, then no one called setSessionId(). As such we are unable to flow
         // to the server as we do not know which session to instruct the server to use.
         SIErrorException e = new SIErrorException(
            nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null)
         );

         FFDCFilter.processException(e, CLASS_NAME + ".unsetAsyncConsumer",
                                     CommsConstants.CONVERSATIONHELPERIMPL_01, this);

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

         throw e;
      }

      CommsByteBuffer request = getCommsByteBuffer();
      // Connection object id
      request.putShort(connectionObjectId);
      // Consumer session id
      request.putShort(sessionId);

      // Pass on call to server
      CommsByteBuffer reply = null;
      try
      {
         reply = jfapExchange(request,
                              (stoppable ? JFapChannelConstants.SEG_DEREGISTER_STOPPABLE_ASYNC_CONSUMER : JFapChannelConstants.SEG_DEREGISTER_ASYNC_CONSUMER), //SIB0115d.comms
                              JFapChannelConstants.PRIORITY_MEDIUM,
                              true);
      }
      catch (SIConnectionLostException e)
      {
         // No FFDC Code needed
         // Converting this to a connection dropped as that is all we can throw
         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Connection was lost", e);

         throw new SIConnectionDroppedException(e.getMessage(), e);
      }

      // Confirm appropriate data returned
      try
      {
         short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_DEREGISTER_ASYNC_CONSUMER_R);
         if (err != CommsConstants.SI_NO_EXCEPTION)
         {
            checkFor_SISessionUnavailableException(reply, err);
            checkFor_SISessionDroppedException(reply, err);
            checkFor_SIConnectionUnavailableException(reply, err);
            checkFor_SIConnectionDroppedException(reply, err);
            checkFor_SIIncorrectCallException(reply, err);
            checkFor_SIErrorException(reply, err);
            defaultChecker(reply, err);
         }
      }
      finally
      {
         if (reply != null) reply.release();
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unsetAsynchConsumer");
   }
175496
private void stop(RpcEndpointTerminationResult rpcEndpointTerminationResult) {
		if (rpcEndpointStopped.compareAndSet(false, true)) {
			this.rpcEndpointTerminationResult = rpcEndpointTerminationResult;
			getContext().stop(getSelf());
		}
	}
501471
public void dispatchStoppableConsumerSessionStopped(ConsumerSessionProxy consumerSessionProxy)
   {
      if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchStoppableConsumerSessionStopped", consumerSessionProxy);

      //Create a new StoppableAsynchConsumerCallbackThread and dispatch it.
      final StoppableAsynchConsumerCallbackThread thread = new StoppableAsynchConsumerCallbackThread(consumerSessionProxy);
      dispatchThread(thread);

      if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchStoppableConsumerSessionStopped");
   }
22679
@Override
    public void stop() {
        super.stop();
        try {
            getContext().unregisterReceiver(mBroadcastReceiver);
        } catch(IllegalArgumentException e) {
            Log.d(TAG, "Unable to unregister receiver when stopping, probably not registered");
        }
    }