WebLogic Messaging API Class Library

IConnection. Method 

Closes the connection.

Since a provider typically allocates significant resources outside the JVM on behalf of a connection, clients should Close these resources when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

There is no need to Close the sessions, producers, and consumers of a closed connection.

Closing a connection causes all temporary destinations to be deleted.

When this method is invoked, it should not return until message processing has been shut down in an orderly fashion. This means that all message listeners that may have been running have returned, and that all pending receives have returned. A Close terminates all pending message receives on the connection's sessions' consumers. The receives may return with a message or with null, depending on whether there was a message available at the time of the Close. If one or more of the connection's sessions' message listeners is processing a message at the time when connection Close is invoked, all the facilities of the connection and its sessions must remain available to those listeners until they return control to the JMS provider.

Closing a connection causes any of its sessions' transactions in progress to be rolled back. In the case where a session's work is coordinated by an external transaction manager, a session's Commit and Rollback methods are not used and the result of a closed session's work is determined later by the transaction manager.

Closing a connection does NOT force an acknowledgment of client-acknowledged sessions.

Invoking the Acknowledge method of a received message from a closed connection's session must throw an IllegalStateException. Closing a closed connection must NOT throw an exception.

void ();

Exceptions

Exception TypeCondition
MessageExceptionif the JMS provider fails to Close the connection due to some internal error. For example, a failure to release resources or to Close a socket connection can cause this exception to be thrown.

See Also

IConnection Interface | WebLogic.Messaging Namespace