<p>Check authority to produce to a destination</p>
@param destinationHandler
@param discriminator
@param msg
@param exceptionReason
@param exceptionInserts
@return
@throws SIStoreException
175301
private boolean checkDestinationAccess(
    DestinationHandler destination,
    String discriminator,
    String userId)
    throws SIDiscriminatorSyntaxException {
    if (tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "checkDestinationAccess",
        new Object[] { destination, discriminator, userId });

    boolean allowed = true;

    // Map a null userid to an empty string
    if (userId == null) {
      userId = ""; // Empty string means those users that have not
      // been authenticated, but who are still, of course,
      // members of EVERYONE. 
    }

    // We use the userid flavour of security context as we need
    // to drive the userid flavour of the sib.security checkDestinationAccess
    // which is attuned for access checks for messages from foreign buses.
    SecurityContext secContext = new SecurityContext(userId, discriminator);

    // Check authority to access the destination    
    if (!destination
      .checkDestinationAccess(secContext, OperationType.RECEIVE)) 
    {
      if (tc.isDebugEnabled())
        SibTr.debug(
          tc,
          "checkDestinationAccess",
          "not authorized to produce to this destination");

      // Build the message for the Exception and the Notification
      String nlsMessage = 
      nls_cwsik.getFormattedMessage("DELIVERY_ERROR_SIRC_18", // USER_NOT_AUTH_SEND_ERROR_CWSIP0306
                                    new Object[] { destination.getName(), 
                                                   userId },
                                    null); 
                                    
      // Fire a Notification if Eventing is enabled
      iProxyHandler.
        getMessageProcessor().
        getAccessChecker().
        fireDestinationAccessNotAuthorizedEvent(destination.getName(),
                                        userId,
                                        OperationType.RECEIVE,
                                        nlsMessage);

      // sib.security will audit this
      allowed = false;
    }

    // Check authority to produce to discriminator
    if (allowed) {
      // If the discriminator is non-wildcarded, we can check authority to consume on
      // the discriminator.
      if (discriminator != null
        && !iProxyHandler
          .getMessageProcessor()
          .getMessageProcessorMatching()
          .isWildCarded(discriminator)) 
      {
        if (!destination
          .checkDiscriminatorAccess(secContext, OperationType.RECEIVE)) 
        {
          if (tc.isDebugEnabled())
            SibTr.debug(
              tc,
              "checkDestinationAccess",
              "not authorized to produce to this discriminator");

          // Write an audit record if access is denied
          SibTr
            .audit(
              tc,
              nls_cwsik
                .getFormattedMessage("DELIVERY_ERROR_SIRC_20",
          // USER_NOT_AUTH_SEND_ERROR_CWSIP0308
          new Object[] {
            destination.getName(),
            discriminator,
            userId },
            null));

          allowed = false;
        }
      }
    }

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "checkDestinationAccess", new Boolean(allowed));
    return allowed;
  }
1244520
@SuppressWarnings("unchecked")
    public void with(ExceptionHandler<? super T> exceptionHandler)
    {
        final EventProcessor eventProcessor = consumerRepository.getEventProcessorFor(eventHandler);
        if (eventProcessor instanceof BatchEventProcessor)
        {
            ((BatchEventProcessor<T>) eventProcessor).setExceptionHandler(exceptionHandler);
            consumerRepository.getBarrierFor(eventHandler).alert();
        }
        else
        {
            throw new RuntimeException(
                "EventProcessor: " + eventProcessor + " is not a BatchEventProcessor " +
                "and does not support exception handlers");
        }
    }
1187030
public SIMPIterator getTransmitMessagesIterator(int maxMsgs) throws SIMPControllableNotFoundException, SIMPRuntimeOperationFailedException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getTransmitMessagesIterator");

    assertValidControllable();

    SIMPIterator msgItr = null;
    try
    {
      msgItr = new SourceStreamSetXmitMessageIterator(maxMsgs);
    }
    catch (SIResourceException e)
    {
      FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.runtime.SourceStreamSetControl.getTransmitMessagesIterator",
          "1:283:1.39",
          this);

        SIMPRuntimeOperationFailedException finalE =
          new SIMPRuntimeOperationFailedException(
            nls.getFormattedMessage(
              "INTERNAL_MESSAGING_ERROR_CWSIP0002",
              new Object[] {"SourceStreamSetControl.getTransmitMessagesIterator",
                  "1:291:1.39",
                            e},
              null), e);

        SibTr.exception(tc, finalE);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getTransmitMessagesIterator", finalE);
        throw finalE;
    }

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

    return msgItr;
  }
927264
@Override
    public void createControlAdapter()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createControlAdapter");

        DestinationHandler dh = null;
        try
        {
            ItemStream is = getItemStream();
            if (is instanceof PubSubMessageItemStream)
            {
                dh = ((PubSubMessageItemStream) is).getDestinationHandler();
                controlAdapter = new QueuedMessage(this, dh, is);
            }
            else if (is instanceof MQLinkMessageItemStream)
            {
                dh = ((MQLinkMessageItemStream) is).getDestinationHandler();
                controlAdapter = new MQLinkQueuedMessage(this, dh, is);
            }
            else if (is instanceof PtoPMessageItemStream)
            {
                dh = ((PtoPMessageItemStream) is).getDestinationHandler();
                controlAdapter = new QueuedMessage(this, dh, is);
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(this, tc, "Unknown item stream type " + is);
            }
        } catch (Exception e)
        {
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.store.items.MessageItem.createControlAdapter",
                                        "1:2585:1.244.1.40",
                                        this);

            SibTr.exception(tc, e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createControlAdapter");
    }
380305
public ClientRequestExecutor checkout(SocketDestination destination) {
        // timing instrumentation (stats only)
        long startTimeNs = 0;
        if(stats != null) {
            startTimeNs = System.nanoTime();
        }

        ClientRequestExecutor clientRequestExecutor;
        try {
            clientRequestExecutor = queuedPool.checkout(destination);
        } catch(Exception e) {
            // If this exception caught here is from the nonBlockingPut call
            // within KeyedResourcePool.attemptGrow(), then there is the chance
            // a ClientRequestExector resource will be leaked. Cannot safely
            // deal with this here since clientRequestExecutor is not assigned
            // in this catch. Even if it was, clientRequestExecutore.close()
            // checks in the SocketDestination resource and so is not safe to
            // call.

            throw UnreachableStoreException.wrap("Failure while checking out socket for "
                                                + destination + ": ", e);
        } finally {
            if(stats != null) {
                stats.recordCheckoutTimeUs(destination, (System.nanoTime() - startTimeNs)
                                                        / Time.NS_PER_US);
                stats.recordCheckoutQueueLength(destination,
                                                queuedPool.getBlockingGetsCount(destination));
            }
        }
        return clientRequestExecutor;
    }
1291525
@Override
    public void notifyReceiveAllowed(DestinationHandler destinationHandler)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "notifyReceiveAllowed", new Object[] { destinationHandler });

        //If this alias destination inherits its receive allowed value, then
        //we must react to a change to the inherited value and tell any aliases
        //that inherit from us about the change
        if (_definition.isReceiveAllowed() == ExtendedBoolean.NONE)
        {
            getTarget().notifyReceiveAllowed(destinationHandler);
            notifyTargettingAliasesReceiveAllowed();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "notifyReceiveAllowed");
    }
626478
public UndeliverableReturnCode handleUndeliverableMessage(
                                                              SIMPMessage message,
                                                              TransactionCommon tran,
                                                              int exceptionReason,
                                                              String[] exceptionStrings,
                                                              String subscriptionID)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "handleUndeliverableMessage",
                        new Object[] { message,
                                      tran,
                                      Integer.valueOf(exceptionReason),
                                      exceptionStrings,
                                      subscriptionID });

        UndeliverableReturnCode rc =
                        handleUndeliverableMessage(message,
                                                   null, // alternateUser
                                                   tran,
                                                   exceptionReason,
                                                   exceptionStrings,
                                                   _messageProcessor.getMessagingEngineUuid(),
                                                   subscriptionID);

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

        return rc;
    }
301150
private javax.jms.Message messageHandler(MessageManager messageManager) throws JMSException {
        if (messageManager == null) {
            return null;
        }        
        javax.jms.Message message = messageManager.getMessage();
        
        // Notify PrefetchThread that message is dispatched
        this.messageDispatched();
        acknowledger.notifyMessageReceived((SQSMessage) message);
        return message;
    }
369978
private DestinationHandler createForeignDestination(DestinationForeignDefinition dfd, String busName) throws SIResourceException, SINotPossibleInCurrentConfigurationException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "createForeignDestination", new Object[] { dfd, busName });

        ForeignDestinationHandler fdh = null;

        //The lock on the destinationManager is taken to stop 2 threads creating the same
        //destination and also to synchronize dynamic deletes with the
        //creation of aliases.  This stops an alias destination being created that targets a
        //destination in the process of being deleted.
        synchronized (this)
        {
            // Create a new DestinationHandler, which is created locked
            fdh = new ForeignDestinationHandler(dfd, messageProcessor, this, findBus(dfd.getBus()), busName);

            DestinationIndex.Type type = new DestinationIndex.Type();
            type.foreignDestination = Boolean.TRUE;
            type.alias = Boolean.FALSE;
            type.local = Boolean.FALSE;
            type.remote = Boolean.FALSE;
            type.queue = new Boolean(!fdh.isPubSub());
            type.state = State.ACTIVE;
            destinationIndex.put(fdh, type);

            fdh.registerControlAdapters();
        }

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

        return fdh;
    }
290147
private JmsDestinationImpl validateDestination(Destination destination) throws JMSException {

        // if this is an identified producer, throw an
        // UnsupportedOperationException as this is an unidentified producer
        // method.

        if (this.dest != null) {
            if (destination == null) {
                throw (InvalidDestinationException) JmsErrorUtils.newThrowable(InvalidDestinationException.class
                                                                               , "INVALID_VALUE_CWSIA0281"
                                                                               , new Object[] { "Destination", null }
                                                                               , tc);
            }

            throw (UnsupportedOperationException) JmsErrorUtils.newThrowable(
                                                                             UnsupportedOperationException.class,
                                                                             "DEST_SPECIFIED_ON_SEND_CWSIA0066",
                                                                             null,
                                                                             tc);
        }

        // if the supplied destination is set to null, or it isn't a jetstream
        // destination, throw a jms InvalidDestinationException.
        // Note that in some situations this method call can return a _different_
        // destination than the one passed in as the parameter (e.g. Spring).
        JmsDestinationImpl nativeDest = JmsDestinationImpl.checkNativeInstance(destination);

        // for an identified producer, this check will have been done at constructor time.
        if (this.dest == null) {
            // Check that this destination is not blocked from creating consumers
            JmsDestinationImpl.checkBlockedStatus(nativeDest);
        }

        return nativeDest;

    }
1347885
private void callDestinationListener(String destinationName) throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "callDestinationListener", new Object[] { destinationName });

        DestinationListenerDataObject listenerDataObject = null;
        DestinationListener destinationListener = null;
        DestinationAvailability listenersDestinationAvailability = null;
        SICoreConnection listenersConnection = null;
        DestinationNamePattern destinationNamePattern = null;

        BaseDestinationHandler destinationHandler = null;

        try
        {
            destinationHandler = (BaseDestinationHandler) getDestination(destinationName, false);
        } catch (SIMPDestinationCorruptException e)
        {
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.DestinationManager.callDestinationListener",
                                        "1:7589:1.508.1.7",
                                        this);

            SibTr.exception(tc, e);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "callDestinationListener", "Destination corrupt");

            // Finding that a restored destination has been marked as corrupt is no
            // reason to cause the transaction to fail.  Andrew Whitfield says that
            // a destination listener will not want to know about corrupt destinations
            // so we end up just returning.
            return;
        } catch (SIException e)
        {
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.DestinationManager.callDestinationListener",
                                        "1:7608:1.508.1.7",
                                        this);

            SibTr.exception(tc, e);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "callDestinationListener", "SIResourceException");
            throw new SIResourceException(e);
        }

        if (!(destinationHandler.definition.getDestinationType() == DestinationType.TOPICSPACE))
        {

            for (int i = 0; i < destinationListeners.size(); i++)
            {
                listenerDataObject = destinationListeners.get(i);
                destinationListener = listenerDataObject.getDestinationLister();
                listenersDestinationAvailability = listenerDataObject.getDestinationAvailability();
                listenersConnection = listenerDataObject.getConnection();
                destinationNamePattern = listenerDataObject.getDestinationNamePattern();

                SIDestinationAddress destinationAddress = null;

                if (isAvailable(destinationHandler, listenersDestinationAvailability)
                    && (!(destinationHandler.isSystem()))
                    && listenerDataObject.getDestinationType() == destinationHandler.definition.getDestinationType())
                {
                    // Check whether a destination name pattern was specified
                    if (destinationNamePattern == null || destinationNamePattern.match(destinationName))
                    {
                        // No pattern or the pattern matches the name.
                        destinationAddress =
                                        (
                                        (SIDestinationAddressFactory) MessageProcessor.getSingletonInstance(
                                                        SIMPConstants.SI_DESTINATION_ADDRESS_FACTORY)).createSIDestinationAddress(
                                                                                                                                  destinationHandler.getName(),
                                                                                                                                  true);
                        // call the listener
                        destinationListener.destinationAvailable(
                                                                 listenersConnection,
                                                                 destinationAddress,
                                                                 listenersDestinationAvailability);
                    }
                }
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "callDestinationListener");
    }
882618
@Override
    public void deliverExpressMessage(MessageItem msgItem,
                                      ExpressTargetStream expressTargetStream)

                    throws SIIncorrectCallException, SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "deliverExpressMessage", new Object[] { msgItem });

        //Create transaction
        LocalTransaction siTran = _txManager.createLocalTransaction(false);

        try
        {
            long endTick = msgItem.getMessage().getGuaranteedValueValueTick();

            JsDestinationAddress routingDestinationAddr =
                            msgItem.getMessage().getRoutingDestination();
            if (routingDestinationAddr != null)
            {
                DestinationHandler routingDestination = null;
                try
                {
                    routingDestination =
                                    _destinationManager.getDestination(routingDestinationAddr, false, true);

                    if (_isLink)
                    {
                        LinkHandler link = (LinkHandler) _destination;

                        // If this is coming in off a link then use the link's configuration
                        // to determine if any local message points should be preferred
                        msgItem.setPreferLocal(link.preferLocalTargetQueuePoint());

                        String linkInboundUserid = ((LinkHandler) _destination).getInboundUserid();
                        if (linkInboundUserid != null)
                        {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                SibTr.debug(tc, "Set link inbound userid: " + linkInboundUserid + ", into message");
                            // Call SIB.security (ultimately) to set inbounduserid into msg
                            _messageProcessor.getAccessChecker().setSecurityIDInMessage(
                                                                                        linkInboundUserid,
                                                                                        msgItem.getMessage());
                        }
                    }
                    // If it's come from another ME in the bus then they're sending it
                    // to this message point because they want to so we prefer the local one.
                    // This allows the mesasge to be re-routed if absolutely necessary.
                    else
                        msgItem.setPreferLocal(true);

                    // Call the handler to deal with the message - passing null as the producer
                    // session id.
                    ProducerInputHandler inputHandler =
                                    (ProducerInputHandler) routingDestination.getInputHandler();

                    inputHandler.handleMessage(msgItem,
                                               siTran,
                                               _messageProcessor.getMessagingEngineUuid());

                } catch (SIException e)
                {
                    // No FFDC code needed

                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    {
                        SibTr.exception(tc, e);
                        SibTr.debug(tc, "Discarding the express message as it could not be from the targetStreamManager");
                    }
                }
            }
            else
            {
                ConsumerDispatcher consumerDispatcher;

                consumerDispatcher = (ConsumerDispatcher) _destination.getLocalPtoPConsumerManager();
                consumerDispatcher.put(msgItem, siTran, null, false);
            }

            // Update the completedPrefix on the stream
            // This will put all ticks before this point into Completed state
            expressTargetStream.setCompletedPrefix(endTick);

            siTran.commit();
        } catch (SIIncorrectCallException e)
        {
            // No FFDC code needed
            handleRollback(siTran);

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

            throw e;
        } catch (SIResourceException e)
        {
            // No FFDC code needed
            handleRollback(siTran);

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

            throw e;
        } catch (RuntimeException e)
        {
            // FFDC
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.PtoPInputHandler.deliverExpressMessage",
                                        "1:2840:1.323",
                                        this);

            handleRollback(siTran);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            {
                SibTr.exception(tc, e);
                SibTr.exit(tc, "deliverExpressMessage", e);
            }

            throw e;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "deliverExpressMessage");
    }
1265933
public void detachAllProducersForNewInputHandler(ProducerInputHandler newHandler)throws SIException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "detachAllProducersForNewInputHandler", newHandler);

    //detach all producers and update
    synchronized (_producers)
    {
      Iterator<MessageProducer> it = _producers.iterator();
      while(it.hasNext())
      {
        ProducerSessionImpl prod = (ProducerSessionImpl)it.next();
        it.remove();
        //attach this to the new input handler
        newHandler.attachProducer(prod);
        prod.updateInputHandler(newHandler);
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "detachAllProducersForNewInputHandler");
  }
216043
public boolean destinationMatches(DestinationHandler destinationHandlerToCompare,
                                    JSConsumerManager consumerDispatcher)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "destinationMatches", new Object[] {destinationHandlerToCompare, consumerDispatcher});

    //For remote get, at the destination localising ME, the destination attached
    //to is never an alias as the alias resolution is done at the getting ME
    boolean matches = (consumerDispatcher.getDestination() == destinationHandlerToCompare);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "destinationMatches", Boolean.valueOf(matches));

    return matches;
  }
344118
@Deprecated
    private void checkProducerAuthority(SIDestinationAddress destAddr,
                                        DestinationHandler destination,
                                        String destinationName,
                                        String busName,
                                        SecurityContext secContext,
                                        boolean system)
                    throws SIDiscriminatorSyntaxException, SINotAuthorizedException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "checkProducerAuthority",
                        new Object[] { destAddr,
                                      destination,
                                      destinationName,
                                      busName,
                                      secContext,
                                      Boolean.valueOf(system) });

        // Check authority to produce to destination unless we're sending to a system
        // queue in the local bus.
        if (!system || (destAddr.getBusName() == null) || destAddr.getBusName().equals(_messageProcessor.getMessagingEngineBus()))
        {
            // Perform the alternate user check first. If an alternateUser was set then we 
            // need to determine whether the connected subject has the authority to perform
            // alternate user checks.

            if (secContext.isAlternateUserBased())
            {
                if (!destination.checkDestinationAccess(secContext,
                                                        OperationType.IDENTITY_ADOPTER))
                {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(tc, "checkProducerAuthority", "not authorized to perform alternate user checks on this destination");

                    // Get the username
                    String userName = secContext.getUserName(true);
                    // Build the message for the Exception and the Notification
                    String nlsMessage =
                                    nls_cwsik.getFormattedMessage("DELIVERY_ERROR_SIRC_18", // USER_NOT_AUTH_SEND_ERROR_CWSIP0306
                                                                  new Object[] { destinationName,
                                                                                userName },
                                                                  null);

                    // Fire a Notification if Eventing is enabled
                    _accessChecker.
                                    fireDestinationAccessNotAuthorizedEvent(destinationName,
                                                                            userName,
                                                                            OperationType.IDENTITY_ADOPTER,
                                                                            nlsMessage);

                    // Thrown if user denied access to destination
                    SIMPNotAuthorizedException e = new SIMPNotAuthorizedException(nlsMessage);

                    e.setExceptionReason(SIRCConstants.SIRC0018_USER_NOT_AUTH_SEND_ERROR);
                    e.setExceptionInserts(new String[] { destinationName, secContext.getUserName(true) });

                    throw e;
                }
            }

            if (!destAddr.isTemporary()) // Non-temorary destination access check
            {
                if (!destination.checkDestinationAccess(secContext,
                                                        OperationType.SEND))
                {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(tc, "checkProducerAuthority", "not authorized to produce to this destination");

                    // Get the username
                    String userName = secContext.getUserName(false);
                    // Build the message for the Exception and the Notification
                    String nlsMessage =
                                    nls_cwsik.getFormattedMessage("DELIVERY_ERROR_SIRC_18", // USER_NOT_AUTH_SEND_ERROR_CWSIP0306
                                                                  new Object[] { destinationName,
                                                                                userName },
                                                                  null);

                    // Fire a Notification if Eventing is enabled
                    _accessChecker.
                                    fireDestinationAccessNotAuthorizedEvent(destinationName,
                                                                            userName,
                                                                            OperationType.SEND,
                                                                            nlsMessage);

                    // Thrown if user denied access to destination
                    SIMPNotAuthorizedException e = new SIMPNotAuthorizedException(nlsMessage);

                    e.setExceptionReason(SIRCConstants.SIRC0018_USER_NOT_AUTH_SEND_ERROR);
                    e.setExceptionInserts(new String[] { destinationName, secContext.getUserName(false) });

                    throw e;
                }
            }
            else // Check authority to produce to temp topic
            {
                // get the temp prefix from the destination name
                String destinationPrefix = SIMPUtils.parseTempPrefix(destinationName);
                if (!_accessChecker.checkTemporaryDestinationAccess(secContext,
                                                                    destinationName, // name of destination  
                                                                    (destinationPrefix == null) ? "" : destinationPrefix, // sib.security wants empty string if prefix is null
                                                                    OperationType.SEND))
                {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(tc, "checkProducerAuthority", "not authorized to produce to temporary destination");

                    // Get the username
                    String userName = secContext.getUserName(false);
                    // Build the message for the Exception and the Notification
                    String nlsMessage =
                                    nls_cwsik.getFormattedMessage("DELIVERY_ERROR_SIRC_19", // USER_NOT_AUTH_SEND_ERROR_CWSIP0306
                                                                  new Object[] { destinationPrefix,
                                                                                userName },
                                                                  null);

                    // Fire a Notification if Eventing is enabled
                    _accessChecker.
                                    fireDestinationAccessNotAuthorizedEvent(destinationPrefix,
                                                                            userName,
                                                                            OperationType.SEND,
                                                                            nlsMessage);

                    // Thrown if user denied access to destination
                    SIMPNotAuthorizedException e = new SIMPNotAuthorizedException(nlsMessage);

                    e.setExceptionReason(SIRCConstants.SIRC0019_USER_NOT_AUTH_SEND_ERROR);
                    e.setExceptionInserts(new String[] { destinationPrefix, secContext.getUserName(false) });

                    throw e;
                }
            }

            // Check authority to produce to discriminator
            if (secContext.testDiscriminatorAtCreate())
            {
                if (!destination.checkDiscriminatorAccess(secContext,
                                                          OperationType.SEND))
                {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(tc, "checkProducerAuthority", "not authorized to produce to this destination's discriminator");
                    // Write an audit record if access is denied
                    SibTr.audit(tc, nls_cwsik.getFormattedMessage(
                                                                  "DELIVERY_ERROR_SIRC_20", // USER_NOT_AUTH_SEND_ERROR_CWSIP0308
                                                                  new Object[] { destination.getName(),
                                                                                secContext.getDiscriminator(),
                                                                                secContext.getUserName(false) },
                                                                  null));

                    // Thrown if user denied access to destination
                    SIMPNotAuthorizedException e = new SIMPNotAuthorizedException(
                                    nls_cwsik.getFormattedMessage(
                                                                  "DELIVERY_ERROR_SIRC_20", // USER_NOT_AUTH_SEND_ERROR_CWSIP0308
                                                                  new Object[] { destination.getName(),
                                                                                secContext.getDiscriminator(),
                                                                                secContext.getUserName(false) },
                                                                  null));

                    e.setExceptionReason(SIRCConstants.SIRC0020_USER_NOT_AUTH_SEND_ERROR);
                    e.setExceptionInserts(new String[] { destination.getName(),
                                                        secContext.getDiscriminator(),
                                                        secContext.getUserName(false) });
                    throw e;
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "checkProducerAuthority");
    }
1309893
@Override
	public QueueSender createSender(Queue queue) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        
	        RemoteQueueSender sender =  new RemoteQueueSender(this,
	                                                          DestinationTools.asRef(queue),
	                                                          idProvider.createID());
	        registerProducer(sender);
	        return sender;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
602857
public void createControlAdapter()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "createControlAdapter");
    
    DestinationHandler dh = null;
    try
    {
      ItemStream is = getItemStream();
      
      // TODO - This method is using the wrong itemstream
  
      dh = ((AOProtocolItemStream) is).getDestinationHandler();
      SIMPMessage msg = (SIMPMessage) is.findById(msgId);
      controlAdapter = new QueuedMessage(msg,dh,is);
    }
    catch(Exception e)
    {
      // FFDC
      FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.impl.store.items.AOValue.createControlAdapter",
          "1:371:1.28.1.5",
          this);  
                  
      SibTr.exception(tc, e); 
    }
         
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "createControlAdapter");
  }