This method is called by a JmsMsgProducer in order to remove itself from
the list of Producers held by the Session.

@param JmsMsgProducer The Producer which is calling this method.
779967
void removeProducer(JmsMsgProducerImpl producer) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "removeProducer", producer);
        producers.remove(producer);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "removeProducer");
    }
643180
public void removeLocked( MessageLock lockRef ) throws JMSException
    {
    	checkTransactionLock();
    	
    	MessageStore targetStore;
    	if (lockRef.getDeliveryMode() == DeliveryMode.NON_PERSISTENT)
    	    targetStore = volatileStore;
    	else
    	{
    	    targetStore = persistentStore;
    	    if (requiresTransactionalUpdate())
    	    	pendingChanges = true;
    	}
    	
    	synchronized (storeLock)
        {
    		targetStore.delete(lockRef.getHandle());
        }
    }
678090
protected final void deleteQueue( String queueName ) throws JMSException
    {
    	transactionSet.removeUpdatesForQueue(queueName);
        engine.deleteQueue(queueName);
    }
452994
@Override
    public void setProducerBind(String bind) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setProducerBind", bind);

        // Make sure null and empty are treated equally.
        if ((bind == null) || ("".equals(bind.trim())))
            bind = null;

        if ((bind == null) ||
            (ApiJmsConstants.PRODUCER_BIND_OFF.equals(bind) ||
            (ApiJmsConstants.PRODUCER_BIND_ON.equals(bind)))) {

            updateProperty(PRODUCER_BIND, bind);
        }
        else {
            // bad value, throw exception
            String key = "INVALID_VALUE_CWSIA0281";
            Object[] inserts = new Object[] { PRODUCER_BIND, bind };
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class, key, inserts, tc);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setProducerBind");
    }
865432
public void setProducer(org.apache.kafka.clients.producer.KafkaProducer<Object, Object> producer) {
        this.producer = producer;
    }
1031554
protected void _closeProducerDestinationDeleted()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "_closeProducerDestinationDeleted");

    /* This routine does similar processing to _close() but it does
     * not call back to the inputHandler to remove the producerSession.  Doing
     * so would stop users of this routine in the inputHandler from using an
     * iterator to close all the producersessions.
     */
    
    // Check if this is actually closing the producer (i.e. it's not already closed)
    boolean closedNow = false;

    synchronized (this)
    {
      if (!_closed)
      {
        _closed = true;
        _inputHandler = null;
        closedNow = true;
      }
    }
    
    // If we've just cosed the session, remove it from the connection's list, although
    // not under 'this' lock as that would deadlock with the connection '_producers' lock.
    if (closedNow)
      _conn.removeProducerSession(this);

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

    return;
  }
1129720
public void closeProducers()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "closeProducers");

    //Tell any destinations that target this destination to close their producers
    if (aliasesThatTargetThisDest != null)
    {
      synchronized(aliasesThatTargetThisDest)
      {
        Iterator i = aliasesThatTargetThisDest.iterator();
        while (i.hasNext())
        {
          AbstractAliasDestinationHandler abstractAliasDestinationHandler = 
            (AbstractAliasDestinationHandler) i.next();
          abstractAliasDestinationHandler.closeProducers();
        }
      }
    }
    
    // Close all producers
    ProducerInputHandler inputHandler = (ProducerInputHandler) getInputHandler();
    
    if (inputHandler != null)
      inputHandler.closeProducersDestinationDeleted();

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

    return;
  }
719643
protected void removeTemporaryDestination(JmsTemporaryDestinationInternal tempDest) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "removeTemporaryDestination", System.identityHashCode(tempDest));

        synchronized (temporaryDestinations) { // synchronize against addTemporaryDestination
            temporaryDestinations.remove(tempDest);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "removeTemporaryDestination");
    }
1050643
@Override
    public void close() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "close");
        try {
            messageConsumer.close();
        } catch (JMSException jmse) {
            JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.entry(this, tc, "close");
        }

    }
695091
@Override
	public MessageProducer createProducer(Destination destination) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        LocalMessageProducer producer = new LocalMessageProducer(this,destination,idProvider.createID());
	        registerProducer(producer);
	        return producer;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
1089274
public void closeProducersDestinationDeleted()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "closeProducersDestinationDeleted");

    synchronized (_producers)
    {
      _destinationDeleted = true;

      Iterator<MessageProducer> i = _producers.iterator();

      while(i.hasNext())
      {
        ProducerSessionImpl producerSessionImpl = (ProducerSessionImpl) i.next();

          // Close the producer session, indicating that it has been closed due to delete
          producerSessionImpl._closeProducerDestinationDeleted();

          // Remove the producer session from the Producers ArrayList
          i.remove();        
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "closeProducersDestinationDeleted");
  }
274916
public void removeMessageListener(Class<? extends Message> messageClass,
                                      MessageListener<Message> messageListener) {
        removeMessageListener(messageListener.getChannelIdentifier(), messageClass, messageListener);
    }
253256
public void removeHandlers() {
    Iterator<HandlerRegistration> it = registrations.iterator();
    while (it.hasNext()) {
      HandlerRegistration r = it.next();

      /*
       * must remove before we call removeHandler. Might have come from nested
       * ResettableEventBus
       */
      it.remove();

      r.removeHandler();
    }
  }
289050
public void removeMessageListener(DigitalChannel channel, MessageListener<? extends Message> messageListener) {
        removeListener(channel.getIdentifier(), messageListener.getMessageType(), messageListener);
    }
248666
public void closeAllConsumersForDelete(DestinationHandler destinationBeingDeleted)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "closeAllConsumersForDelete", destinationBeingDeleted);

        Iterator<DispatchableKey> itr = null;
        Iterator<DispatchableKey> clonedItr = null;

        // The consumerPoints list is cloned for the notifyException
        // call.
        synchronized (consumerPoints)
        {
            //since the close of the underlying session causes the consumer point to
            //be removed from the list we have to take a clone of the list
            clonedItr = ((LinkedList<DispatchableKey>) consumerPoints.clone()).iterator();
            itr = ((LinkedList<DispatchableKey>) consumerPoints.clone()).iterator();
        }

        // Defect 360452
        // Iterate twice to avoid deadlock. First iteration to mark
        // as not ready. This ensure no messages on the destination
        // will arrive at the consumers.
        synchronized (_baseDestHandler.getReadyConsumerPointLock())
        {
            while (itr.hasNext())
            {
                DispatchableKey consumerKey = itr.next();

                // If we're making the consumer notReady then we must also remove
                // them from the list of ready consumers that we hold
                if (consumerKey.isKeyReady())
                    removeReadyConsumer(consumerKey.getParent(), consumerKey.isSpecific());

                consumerKey.markNotReady();
            }
        }

        // Second iteration to close sessions outside of readyConsumerPointLock
        // to avoid deadlock with receive.
        while (clonedItr.hasNext())
        {
            DispatchableKey consumerKey = clonedItr.next();
            consumerKey.getConsumerPoint().implicitClose(destinationBeingDeleted.getUuid(), null, _messageProcessor.getMessagingEngineUuid());
        }

        // Close any browsers
        closeBrowsersDestinationDeleted(destinationBeingDeleted);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "closeAllConsumersForDelete");
    }
803107
@Override
  public void unregisterXAResource(String uniqueName, XAResource xaResource) {
    Ehcache3XAResourceProducer xaResourceProducer = producers.get(uniqueName);

    if (xaResourceProducer != null) {
      boolean found = xaResourceProducer.removeXAResource(xaResource);
      if (!found) {
        throw new IllegalStateException("no XAResource " + xaResource + " found in XAResourceProducer with name " + uniqueName);
      }
      if (xaResourceProducer.isEmpty()) {
        xaResourceProducer.close();
        producers.remove(uniqueName);
      }
    } else {
      throw new IllegalStateException("no XAResourceProducer registered with name " + uniqueName);
    }
  }
679481
public void stop() {
        MessageBatcher batcher = null;
        for (String originalAppenderName : originalAsyncAppenderNameMap.keySet()) {
            String batcherName = AsyncAppender.class.getName() + "." + originalAppenderName;
            batcher = BatcherFactory.getBatcher(batcherName);
            if (batcher == null) {
                continue;
            }
            batcher.stop();
        }
        
        for (String originalAppenderName : originalAsyncAppenderNameMap.keySet()) {
            String batcherName = AsyncAppender.class.getName() + "." + originalAppenderName;
            batcher = BatcherFactory.getBatcher(batcherName);
            if (batcher == null) {
                continue;
            }
            BatcherFactory.removeBatcher(batcherName);
        }
    }