RowAction [ ] getRowActionList ( ) { try { writeLock . lock ( ) ; Session [ ] sessions = database . sessionManager . getAllSessions ( ) ; int [ ] tIndex = new int [ sessions . length ] ; RowAction [ ] rowActions ; int rowActionCount = 0 ; { int actioncount = 0 ; for ( int i = 0 ; i < sessions . length ; i ++ ) { actioncount += sessions [ i ] . getTransactionSize ( ) ; } rowActions = new RowAction [ actioncount ] ; } while ( true ) { boolean found = false ; long minChangeNo = Long . MAX_VALUE ; int sessionIndex = 0 ; // find the lowest available SCN across all sessions for ( int i = 0 ; i < sessions . length ; i ++ ) { int tSize = sessions [ i ] . getTransactionSize ( ) ; if ( tIndex [ i ] < tSize ) { RowAction current = ( RowAction ) sessions [ i ] . rowActionList . get ( tIndex [ i ] ) ; if ( current . actionTimestamp < minChangeNo ) { minChangeNo = current . actionTimestamp ; sessionIndex = i ; } found = true ; } } if ( ! found ) { break ; } HsqlArrayList currentList = sessions [ sessionIndex ] . rowActionList ; for ( ; tIndex [ sessionIndex ] < currentList . size ( ) ; ) { RowAction current = ( RowAction ) currentList . get ( tIndex [ sessionIndex ] ) ; // if the next change no is in this session, continue adding if ( current . actionTimestamp == minChangeNo + 1 ) { minChangeNo ++ ; } if ( current . actionTimestamp == minChangeNo ) { rowActions [ rowActionCount ++ ] = current ; tIndex [ sessionIndex ] ++ ; } else { break ; } } } return rowActions ; } finally { writeLock . unlock ( ) ; } }
Return an array of all row actions sorted by System Change No .