/*
(non-Javadoc)
@see javax.jms.TopicConnection#createTopicSession(boolean, int)
326354
@Override
	public synchronized TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException
    {
        checkNotClosed();
        LocalTopicSession session =  new LocalTopicSession(idProvider.createID(),this,engine,transacted,acknowledgeMode);
        registerSession(session);
        return session;
    }
1186632
JmsSessionImpl instantiateSession(boolean transacted, int acknowledgeMode, SICoreConnection coreConnection, JmsJcaSession jcaSession) throws JMSException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateSession", new Object[]{transacted, acknowledgeMode, coreConnection, jcaSession});
    JmsQueueSessionImpl jmsQueueSession = new JmsQueueSessionImpl(transacted, acknowledgeMode, coreConnection, this, jcaSession);
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateSession",  jmsQueueSession);
    return jmsQueueSession;
  }
835528
void sendSubscriptionEvent(String topic, int nb) {
		Collection<Session> sessions = getSessionsForTopic(topic);
		if (!sessions.isEmpty()) {
			MessageToClient messageToClient = new MessageToClient();
			messageToClient.setId(topic);
			messageToClient.setType(MessageType.MESSAGE);
			messageToClient.setResponse(nb);
//			Collection<Session> sessionsClosed = new ArrayList<>(); // throws java.lang.StackOverflowError
			for (Session session : sessions) {
				if (session.isOpen()) {
					session.getAsyncRemote().sendObject(messageToClient);
//				} else {
//					sessionsClosed.add(session);
				}
			}
//			removeSessionsToTopic(sessionsClosed);
		}
	}
628597
@Override
	public final Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
    {
    	return createSession(idProvider.createID(), transacted, acknowledgeMode);
    }
443340
@Override
  public SimpleOrderedMap<Object> create(ComponentStatus status, Boolean encode)
      throws IOException {
    SimpleOrderedMap<Object> mtasStatusResponse = new SimpleOrderedMap<>();
    if (status.getMtasHandler) {
      mtasStatusResponse.add(NAME_MTAS_STATUS_MTASHANDLER, status.handler);
    }
    if (status.getNumberOfDocuments) {
      mtasStatusResponse.add(NAME_MTAS_STATUS_NUMBEROFDOCUMENTS,
          status.numberOfDocuments);
    }
    if (status.getNumberOfSegments) {
      mtasStatusResponse.add(NAME_MTAS_STATUS_NUMBEROFSEGMENTS,
          status.numberOfSegments);
    }
    if(mtasStatusResponse.size()>0) {
      mtasStatusResponse.add(ShardInformation.NAME_NAME, status.name);
      if (status.key != null) {
        mtasStatusResponse.add(NAME_MTAS_STATUS_KEY, status.key); 
      }
      return mtasStatusResponse;
    } else {
      return null;
    }  
  }
201615
@Override
    public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException {
        connectionLock.readLock().lock();
        try {
            ManagedSession managedSession = new ManagedSession(
                    getConnection().createSession(transacted, acknowledgeMode),
                    transacted,
                    acknowledgeMode,
                    connectionDefinition.isJeeMode(),
                    this);
            sessions.add(managedSession);
            return managedSession;
        } finally {
            connectionLock.readLock().unlock();
        }
    }
356046
@Override
    public Message createMessage(Session session) throws JMSException {
        Message message = session.createTextMessage(requestMessage);
        if (correlationId != null)
            message.setJMSCorrelationID(correlationId);
        if (replyQueue != null) {
            message.setJMSReplyTo(replyQueue);
        }
        if (delaySeconds >0) {
            ApplicationContext.getJmsProvider().setMessageDelay(null, message, delaySeconds);
        }
        return message;
    }
408161
@Override
    public java.util.concurrent.Future<CreateTopicResult> createTopicAsync(String name,
            com.amazonaws.handlers.AsyncHandler<CreateTopicRequest, CreateTopicResult> asyncHandler) {

        return createTopicAsync(new CreateTopicRequest().withName(name), asyncHandler);
    }
195334
protected Session createSession(Connection connection) throws JMSException {
        if (connection instanceof QueueConnection) {
            return ((QueueConnection) connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        }
        return connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    }
559991
@Override
    public java.util.concurrent.Future<CreateTopicResult> createTopicAsync(String name) {

        return createTopicAsync(new CreateTopicRequest().withName(name));
    }
1257881
public void createDestination(Destination dest, Reliability defaultReliability) 
    throws JMSException
  {

    try
    {
    
      if (tcInt.isEntryEnabled())
        SibTr.entry(tcInt, "createDestination(Destination)");    
         
      com.ibm.wsspi.sib.core.DestinationType destType = null;
      String name = null;
  
      try
      {
  
        // Work out which type of Destination we want to create.
        if (dest instanceof JmsQueue)
        {
          destType = com.ibm.wsspi.sib.core.DestinationType.QUEUE;
          name = ((JmsQueue) dest).getQueueName();
  
        } else if (dest instanceof JmsTopic)
        {
          destType = com.ibm.wsspi.sib.core.DestinationType.TOPICSPACE;
          name = ((JmsTopic) dest).getTopicSpace();
        } else
        {
          destType = null;
          name = null;
        }
        
        if (tcInt.isDebugEnabled())
        {
          SibTr.debug(tcInt, "    name: "+name);
          SibTr.debug(tcInt, "destType: "+destType);
        }
          
  
        if (destType != null)
        {
          // Defer to the other method.
          createDestination(name, destType, defaultReliability);
        } else
        {
          throw new JMSException("Could not create Destination - destType was null");
        }
  
      } catch (JMSException e)
      {
        // No FFDC code needed
        if (tcInt.isDebugEnabled())
          SibTr.debug(tcInt, "JMSException during createDestination", e);
          
        throw e;
  
      } catch (Exception f)
      {
        // No FFDC code needed
        if (tcInt.isDebugEnabled())
          SibTr.debug(tcInt, "Exception during createDestionation", f);
          
        JMSException jmse = new JMSException("Exception from createDestination");
        jmse.setLinkedException(f);
        jmse.initCause(f);
        throw jmse;
  
      } //try

    } finally
    {    
      if (tcInt.isEntryEnabled())
         SibTr.exit(tcInt, "createDestination(Destination)");
    }//

  }
1353314
@SuppressWarnings("unchecked")
    private LinkedHashMap<String, XMLObject> initializeSession() {
        Optional<LinkedHashMap<String, XMLObject>> messages = (Optional<LinkedHashMap<String, XMLObject>>)
                context.getSessionStore().get(context, SAML_STORAGE_KEY);
        if (!messages.isPresent()) {
            synchronized (context) {
                messages = (Optional<LinkedHashMap<String, XMLObject>>) context.getSessionStore().get(context, SAML_STORAGE_KEY);
                if (!messages.isPresent()) {
                    messages = Optional.of(new LinkedHashMap<>());
                    updateSession(messages.get());
                }
            }
        }
        return messages.get();
    }
1061136
@Override
    public Topic createTopic(String topicName) throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createTopic", new Object[] { topicName });

        Topic topic = null;

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

        return topic;
    }
151556
@JsTopic
	@WsDataService
	public Integer subscribe(@JsTopicName(prefix = Constants.Topic.SUBSCRIBERS) String topic, Session session) throws IllegalAccessException {
		return topicManager.registerTopicSession(topic, session);
	}
972769
public <T> TopicProducer<T> createTopicProducer(final String topic, final ProducerCallback<T> messageCallback)
    {
        Preconditions.checkState(connectionFactory != null, "connection factory was never injected!");
        return new TopicProducer<T>(connectionFactory, jmsConfig, topic, messageCallback);
    }
626863
public HttpSession newHttpSession(HttpServletRequest request)
    {
        Session session = newSession(request);
        session.setMaxInactiveInterval(_dftMaxIdleSecs);
        synchronized(__allSessions)
        {
            synchronized(this)
            {
              _sessions.put(session.getId(),session);
              __allSessions.add(session.getId(), session);
              if (_sessions.size() > this._maxSessions)
                  this._maxSessions = _sessions.size ();
            }
        }
        
        HttpSessionEvent event=new HttpSessionEvent(session);
        
        for(int i=0;i<_sessionListeners.size();i++)
            ((HttpSessionListener)_sessionListeners.get(i))
            .sessionCreated(event);
        
        if (getCrossContextSessionIDs())
            request.setAttribute(__NEW_SESSION_ID, session.getId());
        return session;
    }
273349
public void setTopicSpace(final String topicSpace) {
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
            SibTr.debug(this, TRACE, "setTopicSpace", topicSpace);
        }
        _topicSpace = topicSpace;
        dynamicallyCreateDestination();
    }