2 Replies Latest reply on Apr 30, 2003 11:20 AM by John Emerson

    Question about connections & session

    Michael Klem Newbie

      I am a JMS newbie and have the following questions.

      Does it make sense to create a single Connection object and keep it open for the life of an application?

      When/why would I ever need more than one Topic or QueueConnection?

      Should a session object be kept open for the life of the object that is using it or should it be opened/closed only when it needs to work with JMS?

      Finally, If I close a Connection does it automatically close any open sessions?

        • 1. Re: Question about connections & session
          Adrian Brock Master

          A single connection usually represents a single
          thread sending/receiving over the network.
          This may become a bottle neck?

          Holding sessions open isn't really a problem,
          except that they use some resources on the server.

          On the server, you can use the connection manager
          "java:/JmsXA" that pools sessions.

          Closing the connection, closes all session which
          closes all receivers/subscribers/etc.


          • 2. Re: Question about connections & session
            John Emerson Newbie

            I have a multi-threaded application where each thread has its own sessions but they all share one connection. Lots of traffic flows in and out of each thread. Do you advocate maintaining a connection per thread as opposed to threads sharing a connection?

            The documentation suggests that it is best to use the RMI IL if one has multiple threads sharing a connection. Is this still the case? If I use a connection per thread, can I then use a different IL? I'm currently using OIL (inappropriately??) but I'd like to move to UIL2.

            Is UIL2 still experimental?