public void close ( boolean closingConnection ) throws SIResourceException , SIConnectionLostException , SIErrorException , SIConnectionDroppedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "close" , closingConnection ) ; if ( executingOnCallbackThread ( ) ) { callbackThreadState = CallbackThreadState . CLOSED ; } else { synchronized ( callbackLock ) { boolean closeProxyQueue = false ; // Take the synchLock to exclude other synchronous calls synchronized ( synchLock ) { if ( ( state != StateEnum . CLOSED ) && ( state != StateEnum . CLOSING ) ) { state = StateEnum . CLOSING ; // If we have a proxy queue, notify it that we // are starting to close (this allows it to wake up // receiveWithWait calls). if ( proxyQueue != null ) closeProxyQueue = true ; else { // If we don't have a proxy queue (and thus cannot // have an asynchronous callback) then call _close // to send the close flow across the network. state = StateEnum . CLOSED ; if ( ! closingConnection && ! isClosed ( ) ) { _close ( ) ; if ( currentOrderingContext != null ) { currentOrderingContext . decrementUseCount ( ) ; currentOrderingContext = null ; } } } } } if ( closeProxyQueue ) proxyQueue . closing ( ) ; // Take the synchLock so that we can change the state // of the session. synchronized ( synchLock ) { if ( state == StateEnum . CLOSING ) { state = StateEnum . CLOSED ; if ( ! closingConnection && proxyQueue != null ) { // If we have a proxy queue, tell it that we // are closed - this will exchange the close // flow across the network for us. proxyQueue . closed ( ) ; if ( currentOrderingContext != null ) { currentOrderingContext . decrementUseCount ( ) ; currentOrderingContext = null ; } } } } } // synchronized (callbackLock) } // Remove the consumer from the connection getConnectionProxy ( ) . consumerClosedNotification ( getProxyID ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "close" ) ; }
Closes the consumer session .