/*
(non-Javadoc)
@see javax.jms.QueueSession#createReceiver(javax.jms.Queue, java.lang.String)
2787
@Override
	public QueueReceiver createReceiver(Queue queue, String messageSelector) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        
	        RemoteQueueReceiver receiver =  new RemoteQueueReceiver(idProvider.createID(),
	        		                                                this,
	                                                                DestinationTools.asRef(queue),
	                                                                messageSelector);
	        registerConsumer(receiver);
	        receiver.remoteInit();
	        return receiver;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
10062
public QueueProducer<Object> createQueueJsonMessageProducer(final String topic)
    {
        Preconditions.checkState(connectionFactory != null, "connection factory was never injected!");
        return new QueueProducer<Object>(connectionFactory, jmsConfig, topic, producerCallback);
    }
729768
public JsJmsMapMessage createJmsMapMessage() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsMapMessage");
    JsJmsMapMessage msg = null;
    try {
      msg = new JsJmsMapMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsMapMessage");
    return msg;
  }
129794
@Override
    public QueueConnectionFactory createQueueConnectionFactory(JmsJcaConnectionFactory jcaConnectionFactory, JmsJcaManagedQueueConnectionFactory jcaManagedQueueConnectionFactory) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createQueueConnectionFactory", new Object[] { jcaConnectionFactory, jcaManagedQueueConnectionFactory });
        QueueConnectionFactory qcf = new JmsQueueConnectionFactoryImpl(jcaConnectionFactory, jcaManagedQueueConnectionFactory);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createQueueConnectionFactory", qcf);
        return qcf;
    }
1083358
@Override
	public TopicSubscriber createDurableSubscriber(Topic topic, String subscriptionName, String messageSelector, boolean noLocal) throws JMSException
    {
    	throw new IllegalStateException("Method not available on this domain.");
    }
529660
public static BaseMessageHeader createMessageHeader(String strMessageHeaderClassName, String strQueueName, String strQueueType, Object source, Map<String,Object> properties)
    {
        BaseMessageHeader messageHeader = (BaseMessageHeader)ClassServiceUtility.getClassService().makeObjectFromClassName(strMessageHeaderClassName);
        if (messageHeader != null)
        	messageHeader.init(strQueueName, strQueueType, source, properties);
        return messageHeader;
    }
138646
public TrmClientAttachReply createNewTrmClientAttachReply() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createNewTrmClientAttachReply");
    TrmClientAttachReply msg = null;
    try {
      msg = new TrmClientAttachReplyImpl();
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createNewTrmClientAttachReply");
    return msg;
  }
520132
private TopicSubscriber createDurableSubscriber(Topic topic, String name, String messageSelector, boolean noLocal, boolean isSharedDurable, boolean isNonSharedDurable) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createDurableSubscriber", new Object[] { topic, name, messageSelector, noLocal, isSharedDurable, isNonSharedDurable });

        checkNotClosed();
        if (topic == null) {
            throw (InvalidDestinationException) JmsErrorUtils.newThrowable(InvalidDestinationException.class,
                                                                           "INVALID_VALUE_CWSIA0048",
                                                                           new Object[] { "Topic", "null" },
                                                                           tc
                            );
        }

        if ((name == null) || ("".equals(name))) {
            throw (InvalidDestinationException) JmsErrorUtils.newThrowable(InvalidDestinationException.class,
                                                                           "INVALID_VALUE_CWSIA0048",
                                                                           new Object[] { "name", name },
                                                                           tc
                            );
        }

        // Check that this is not a foreign implementation.
        // 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(topic);

        // Check that this destination is not blocked
        JmsDestinationImpl.checkBlockedStatus(nativeDest);

        //client ID check should be there for only for non-shared. For shared client ID should be optional
        String clientID = connection.getClientID();
        if (isNonSharedDurable) {
            if ((clientID == null) || ("".equals(clientID))) {
                throw (IllegalStateException) JmsErrorUtils.newThrowable(IllegalStateException.class,
                                                                         "INVALID_VALUE_CWSIA0048",
                                                                         new Object[] { "clientID", clientID },
                                                                         tc
                                );
            }
        }

        // Look up the subscription home that was set on the ConnectionFactory
        // at the point when the Connection was created.
        String durSubHome = (String) passThruProps.get(JmsraConstants.DURABLE_SUB_HOME);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(this, tc, "DurableSubHome : " + durSubHome);

        // We demand that if durable subscriptions are being used then the user
        // must have specified a durable subscription home on the ConnectionFactory
        // before they create the connection.
        if ((durSubHome == null) || ("".equals(durSubHome))) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "User Error - No durableSubscriptionHome was specified.");
            throw (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
                                                                               "DURABLE_SUB_HOME_NOT_SPECIFIED_CWSIA0056",
                                                                               null,
                                                                               tc
                            );
        }

        // Now determine whether or not we are running in a cloned environment.
        String sharedSubs = (String) passThruProps.get(JmsInternalConstants.SHARE_DSUBS);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(this, tc, "shareDurableSubs: " + sharedSubs);
        boolean supportsMultiple = false;
        if ((sharedSubs == null)
            || ("".equals(sharedSubs))
            || (ApiJmsConstants.SHARED_DSUBS_IN_CLUSTER.equals(sharedSubs))) {
            // The application asked us to work it out for ourselves (default)
            boolean isCloned = JmsConnectionImpl.isClonedServer();
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "isClonedServer: " + isCloned);
            // Pass the cloned state in as the instruction to support
            // multiple consumers on this durable subscription.
            supportsMultiple = isCloned;
        }
        else if (ApiJmsConstants.SHARED_DSUBS_ALWAYS.equals(sharedSubs)) {
            // The application stated explicitly it wants to share.
            supportsMultiple = true;
        }
        else {
            // The safe behaviour is to not support multiple consumers.
            supportsMultiple = false;
        }

        //if the call is made from createSharedDurableConsumer, set supportsMultiple to true
        //otherwise leaving the property as it is
        if (isSharedDurable)
            supportsMultiple = true;

        //if the call is made from CreateSharedConsumer i.e non-shared durable then
        //set supportsMultiple to false, otherwise leaving the property as it is
        if (isNonSharedDurable)
            supportsMultiple = false;

        // Create the consumer properties object filling in as much information
        // as we have available at the moment.
        ConsumerProperties newProps = new ConsumerProperties(nativeDest,
                        null, // DestType                filled in later
                        messageSelector, // Selector
                        null, // Reliability             filled in later
                        false, // ReadAhead               filled in later
                        true, // RecovExpress            filled in later
                        noLocal, // NoLocal
                        name, // SubName
                        clientID, // ClientID
                        supportsMultiple,// SupportMultiple
                        durSubHome // DurableSubscriptionHome
        );

        TopicSubscriber durableSubscriber = new JmsDurableSubscriberImpl(coreConnection, this, newProps);
        // newly created consumer is synchronous
        syncConsumers.add(durableSubscriber);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createDurableSubscriber", durableSubscriber);
        return durableSubscriber;
    }
198700
public void registerMessageListener(MessageListenerDefinition messageListenerDefinition) {
        checkNotNull(messageListenerDefinition);

        ConnectionDefinition connectionDefinition = connectionDefinitions.get(messageListenerDefinition.getConnectionName());
        if (connectionDefinition.isJeeMode() && messageListenerDefinition.getPoller() == null) {
            throw SeedException.createNew(JmsErrorCode.MESSAGE_POLLER_REQUIRED_IN_JEE_MODE)
                    .put(ERROR_CONNECTION_NAME, connectionDefinition.getName())
                    .put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
        }

        try {
            createMessageConsumer(messageListenerDefinition);
        } catch (JMSException e) {
            throw SeedException.wrap(e, JmsErrorCode.UNABLE_TO_CREATE_MESSAGE_CONSUMER)
                    .put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
        }

        if (messageListenerDefinitions.putIfAbsent(messageListenerDefinition.getName(), messageListenerDefinition) != null) {
            throw SeedException.createNew(JmsErrorCode.DUPLICATE_MESSAGE_LISTENER_NAME)
                    .put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
        }
    }
1238839
private void createListener(final SibRaMessagingEngineConnection connection)
                    throws ResourceException
    {

        final String methodName = "createListener";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName, connection);
        }

        if (_endpointConfiguration.getUseDestinationWildcard())
        {
            createMultipleListeners(connection);
        }
        else
        {
            createSingleListener(connection);
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName);
        }

    }
913649
public ReceiverQueue createReceiver(int limit) {
		synchronized (receivers) {
			ReceiverQueue q = null;
			if (!closed && (maxNrofReceivers == 0 || receivers.size() < maxNrofReceivers)) {
				q = new ReceiverQueue(/*this, */limit);
				receivers.add(q);
			}
			return q;
		}
	}
806485
@Override
    public TextMessage createTextMessage() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createTextMessage");

        TextMessage textMessage = null;

        try {
            textMessage = jmsSession.createTextMessage();
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createTextMessage", new Object[] { textMessage });
        }

        return textMessage;

    }
166996
SibRaListener createListener(final SIDestinationAddress destination, MessageEndpointFactory messageEndpointFactory)
                    throws ResourceException {

        final String methodName = "createListener";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName, new Object[] { destination, messageEndpointFactory });
        }

        if (_closed) {

            throw new IllegalStateException(NLS
                            .getString("LISTENER_CLOSED_CWSIV0952"));

        }

        final SibRaListener listener;

        listener = new SibRaSingleProcessListener(this, destination, messageEndpointFactory);
        _listeners.put(destination, listener);

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName, listener);
        }
        return listener;

    }
1043145
public TrmMeBridgeRequest createNewTrmMeBridgeRequest() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createNewTrmMeBridgeRequest");
    TrmMeBridgeRequest msg = null;
    try {
      msg = new TrmMeBridgeRequestImpl();
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createNewTrmMeBridgeRequest");
    return msg;
  }
188410
@Override
	public MessageToClient createMessageToClient(MessageFromClient message, HttpSession client) {
		return super.createMessageToClient(message, client);
	}
600414
@Override
	public final void setMessageListener(MessageListener messageListener) throws JMSException
    {
        super.setMessageListener(messageListener);
        
        // If the connection was already started, wake up the new listener in case there were messages
        // waiting in the destination
        if (messageListener != null && session.getConnection().isStarted())
        	wakeUpMessageListener();
    }
1093089
public JsJmsBytesMessage createJmsBytesMessage() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsBytesMessage");
    JsJmsBytesMessage msg = null;
    try {
      msg = new JsJmsBytesMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsBytesMessage");
    return msg;
  }