question: public void commit ( ) throws JMSException { ensureOpen ( ) ; ensureTX ( ) ; if ( _logger . isLoggable ( Level . FINE ) ) { _logger . fine ( "GSSessionImpl.commit(): Committing JMS transaction: " + _tx ) ; } try { sendMessages ( this . sentMessages , _tx ) ; if ( _logger . isLoggable ( Level . FINE ) ) { _logger . fine ( "GSSessionImpl.commit(): Committing local transaction: " + _tx ) ; } commitLocalTransaction ( ) ; renewTransaction ( ) ; } catch ( JMSException mfE ) { if ( _logger . isLoggable ( Level . SEVERE ) ) { _logger . log ( Level . SEVERE , "JMSException during GSSessionImpl.commit(): " , mfE ) ; _logger . log ( Level . SEVERE , "Rolling back transaction: " + _tx ) ; } try { rollback ( ) ; } catch ( JMSException e ) { if ( _logger . isLoggable ( Level . SEVERE ) ) { _logger . log ( Level . SEVERE , "Failed to roll back transaction: " + _tx , e ) ; } } TransactionRolledBackException tE = new TransactionRolledBackException ( "JMSException during GSSessionImpl.commit()" ) ; tE . setLinkedException ( mfE ) ; throw tE ; } catch ( TransactionException te ) { if ( _logger . isLoggable ( Level . SEVERE ) ) { _logger . log ( Level . SEVERE , "TransactionException during GSSessionImpl.commit(): " , te ) ; _logger . log ( Level . SEVERE , "Rolling back transaction: " + _tx ) ; } try { rollback ( ) ; } catch ( JMSException e ) { if ( _logger . isLoggable ( Level . SEVERE ) ) { _logger . log ( Level . SEVERE , "Failed to roll back transaction: " + _tx , e ) ; } } TransactionRolledBackException e = new TransactionRolledBackException ( "TransactionException during GSSessionImpl.commit()" ) ; e . setLinkedException ( te ) ; throw e ; } catch ( RemoteException re ) { if ( _logger . isLoggable ( Level . SEVERE ) ) { _logger . log ( Level . SEVERE , "RemoteException during GSSessionImpl.commit(): " , re ) ; _logger . log ( Level . SEVERE , "Rolling back transaction: " + _tx ) ; } try { rollback ( ) ; } catch ( JMSException e ) { } TransactionRolledBackException e = new TransactionRolledBackException ( "RemoteException during GSSessionImpl.commit()" ) ; e . setLinkedException ( re ) ; throw e ; } catch ( CommitFailedException cfe ) { if ( _logger . isLoggable ( Level . SEVERE ) ) { _logger . log ( Level . SEVERE , "Internal error during GSSessionImpl.commit(): " , cfe . orig ) ; _logger . log ( Level . SEVERE , "Rolling back transaction: " + _tx ) ; } try { rollback ( ) ; } catch ( JMSException e ) { if ( _logger . isLoggable ( Level . SEVERE ) ) { _logger . log ( Level . SEVERE , "Failed to roll back transaction: " + _tx , e ) ; } } TransactionRolledBackException e = new TransactionRolledBackException ( "Failed to commit transaction:" + _tx + "\nThe transaction was rolled back." ) ; e . setLinkedException ( cfe . orig ) ; throw e ; } catch ( TransactionCreateException tce ) { if ( _logger . isLoggable ( Level . SEVERE ) ) { _logger . log ( Level . SEVERE , "Failed to renew transaction after commit: " , tce . orig ) ; _logger . log ( Level . SEVERE , "Rolling back transaction: " + _tx ) ; } JMSException e = new JMSException ( "Failed to renew transaction after commit" ) ; e . setLinkedException ( tce . orig ) ; throw e ; } finally { sentMessages . clear ( ) ; unackedMessages . clear ( ) ; } }
target:  Commits all messages done in this transaction and releases any locks currently held.