WebLogic Messaging API Class Library

ISession.Close Method 

Closes the session.

Since JMS allocates resources on behalf of a session outside the JVM, clients should Close the 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 producers and consumers of a closed session. Similarly, there is no need to Close a session if its parent connection is closed or if its parent context has been closed with CloseAll.

This call will block until a Receive call or message listener in progress has completed. A blocked message consumer Receive call returns null when this session is closed.

Closing a transacted session rolls back the transaction in progress.

This method is the only ISession method that can be called concurrently.

Invoking any other ISession method on a closed session throws a MessageException.IllegalStateException. Closing a closed session does not not throw an exception.

void Close();

Exceptions

Exception TypeCondition
MessageExceptionif JMS fails to Close the session due to some internal error.

See Also

ISession Interface | WebLogic.Messaging Namespace