public final void setTransactionIsolation ( int isoLevel ) throws SQLException { if ( currentTransactionIsolation != isoLevel ) { // Reject switching to an isolation level of TRANSACTION_NONE if ( isoLevel == Connection . TRANSACTION_NONE ) { throw new SQLException ( AdapterUtil . getNLSMessage ( "DSRA4011.tran.none.iso.switch.unsupported" , dsConfig . get ( ) . id ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Set Isolation Level to " + AdapterUtil . getIsolationLevelString ( isoLevel ) ) ; // Don't update the isolation level until AFTER the operation completes // succesfully on the underlying Connection. sqlConn . setTransactionIsolation ( isoLevel ) ; currentTransactionIsolation = isoLevel ; isolationChanged = true ; } if ( cachedConnection != null ) cachedConnection . setCurrentTransactionIsolation ( currentTransactionIsolation , key ) ; }
Set the transactionIsolation level to the requested Isolation Level . If the requested and current are the same then do not drive it to the database If they are different drive it all the way to the database .