Solace Community is getting a facelift!

On March 3rd we will be starting the process of migrating Solace Community to a new platform. As a result, Solace Community will go in to a temporary read-only state. You will still be able to come onto Solace Community and search through posts to find answers, but you won't be able to ask questions, post comments, or react in any way.

We hope to have the migration complete by Wednesday March 5th (or sooner), so please keep an eye out!

How properly close JCSMPSession

pierrett75
pierrett75 Member Posts: 2
edited August 2022 in General Discussions #1
Hello i need advice, we use sol-jcsmp version 10.15.0 Session is create with XmlMessageLIstener, XmlMessageConsumer and XMl MessageProducer. 
gproducer is create by JCSMPStreamingPublishCorrelatingEventHandler. 
wwhen i want to close session i call session.clouseSession() Problem is that after close i still can see running thred from ConsumerNotificationDispatcher.run 
and SyncEventDispatcherReacto.
How do i close all these thread properly ?

Thanks Petra

Answers

  • Ragnar
    Ragnar Member, Employee Posts: 67 Solace Employee

    Hi Petra,

    The ConsumerNotificationDispatcher and SyncEventDispatcherReactor thread are both created once per context and handle all sessions in the context.

    They will not exist when any Session is closed. However they will exit when the context is destroyed.

  • pierrett75
    pierrett75 Member Posts: 2

    Hi @Ragnar for response, so how i can destroy context ? we create JCSMPSession, with XMLmessageConsumer, we close the session.closeSession() but when i print threads a can see threads connected with solace:

    Context_1_ReactorThread RUNNABLE true

    sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)

    sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:314)

    sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:293)

    sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:174)

    sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)

    sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)

    com.solacesystems.jcsmp.protocol.nio.impl.SyncEventDispatcherReactor.eventLoop(SyncEventDispatcherReactor.java:153)

    com.solacesystems.jcsmp.protocol.nio.impl.SyncEventDispatcherReactor$SEDReactorThread.run(SyncEventDispatcherReactor.java:338)

    java.lang.Thread.run(Thread.java:748)

    Context_1_ConsumerDispatcher WAITING true

    sun.misc.Unsafe.park(Native Method)

    java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

    java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

    java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403)

    com.solacesystems.jcsmp.protocol.nio.impl.ConsumerNotificationDispatcher.eventLoop(ConsumerNotificationDispatcher.java:111)

    com.solacesystems.jcsmp.protocol.nio.impl.ConsumerNotificationDispatcher.run(ConsumerNotificationDispatcher.java:130)

    java.lang.Thread.run(Thread.java:748)

This Month's Leaders

This Week's Leaders