From this thread in JBoss community http://community.jboss.org/wiki/ShouldICacheJMSConnectionsAndJMSSessions, it makes sense to not cache JMS connection/session if the client resides in a container. In HornetQ manual, it is stated that "Please note that JMS connections, sessions, producers and consumers are designed to be re-used. It's an anti-pattern to create new connections, sessions, producers and consumers for each message you produce or consume.". I am assuming this statement applies when the client is a standalone class or if it is using Hornet's client APIs. Is that a fair assumption?
yes I think so. However I is generally true in any situations. Only that within a container those resources are properly cached and re-used by the container.