Question: How much is the overhead of creating following objects everytime sending the message to queue?
Objects: `javax.jms.Connection`, `javax.jms.Session`, `javax.jms.MessageProducer`

In my code, Whenever I want to send a message, I am creating above 3 objects.

I know its good to create object only once and use it but the connection/session goes into *IllegalState* after Server Failover. My `connectionFactory` is able to reconnect but it is not able to refresh connection/session object.

Can someone please explain me the overhead?

Answer: 
<https://developer.jboss.org/wiki/ShouldICacheJMSConnectionsAndJMSSessions> 

[High Performance JMS Messaging](https://stackoverflow.com/questions/11840630/high-performance-jms-messaging)

:)
It is always a costly affair to create a connection and session to a messaging provider every time. Every time a connection is requested, the underlying messaging library has to create a socket connection to messaging provider, flow some handshake data and establish a channel using which messages can be sent. After message is sent, connection close also requires some messaging provider specific data to be sent across to gracefully close connections. 

You can quantify the overhead by running some tests with and without creating connections/session every time. But the above explanation gives a hint on what would be involved in creating/closing a connection.