You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Tom Johnson <tj...@microaut.com> on 2008/02/27 19:43:30 UTC

Closing connection properly in C++?

When I close the connection using the CMS C++ library, I get six IOExceptions
logged to the debug console of VS2005.   These don't seem to cause a
problem, but wondering if I'm forgetting to do something.  I am currently
doing it this way:

if (producer!=NULL) {
			delete producer;
			producer=NULL;
		}
		if (destination!=NULL) {
			delete destination;
			destination=NULL;
		}
		// close session and connection before deleting
		if (session!=NULL)
			session->close();
		if (connection!=NULL)
			connection->close();
		if (session!=NULL) {
			delete session;
			session=NULL;
		}
		if (connection!=NULL) {
			delete connection;
			connection=NULL;
		}
 
Am I forgetting to do anything?

-- 
View this message in context: http://www.nabble.com/Closing-connection-properly-in-C%2B%2B--tp15720035s2354p15720035.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Closing connection properly in C++?

Posted by Timothy Bish <ta...@gmail.com>.
Its normal to see a couple exceptions on closing down the transport,
depending on your version there may be more things logged, we've cleaned
up some of that in later releases and trunk is even better.

Regards
Tim.

On Wed, 2008-02-27 at 10:43 -0800, Tom Johnson wrote:
> When I close the connection using the CMS C++ library, I get six IOExceptions
> logged to the debug console of VS2005.   These don't seem to cause a
> problem, but wondering if I'm forgetting to do something.  I am currently
> doing it this way:
> 
> if (producer!=NULL) {
> 			delete producer;
> 			producer=NULL;
> 		}
> 		if (destination!=NULL) {
> 			delete destination;
> 			destination=NULL;
> 		}
> 		// close session and connection before deleting
> 		if (session!=NULL)
> 			session->close();
> 		if (connection!=NULL)
> 			connection->close();
> 		if (session!=NULL) {
> 			delete session;
> 			session=NULL;
> 		}
> 		if (connection!=NULL) {
> 			delete connection;
> 			connection=NULL;
> 		}
>  
> Am I forgetting to do anything?
>