public void updateLobUsage ( boolean commit ) { if ( ! hasLobOps ) { return ; } hasLobOps = false ; if ( commit ) { for ( int i = 0 ; i < createdLobs . size ( ) ; i ++ ) { long lobID = createdLobs . get ( i ) ; int delta = lobUsageCount . get ( lobID , 0 ) ; if ( delta == 1 ) { lobUsageCount . remove ( lobID ) ; createdLobs . remove ( i ) ; i -- ; } else if ( ! session . isBatch ) { database . lobManager . adjustUsageCount ( lobID , delta - 1 ) ; lobUsageCount . remove ( lobID ) ; createdLobs . remove ( i ) ; i -- ; } } if ( ! lobUsageCount . isEmpty ( ) ) { Iterator it = lobUsageCount . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { long lobID = it . nextLong ( ) ; int delta = lobUsageCount . get ( lobID ) ; database . lobManager . adjustUsageCount ( lobID , delta - 1 ) ; } lobUsageCount . clear ( ) ; } return ; } else { for ( int i = 0 ; i < createdLobs . size ( ) ; i ++ ) { long lobID = createdLobs . get ( i ) ; database . lobManager . deleteLob ( lobID ) ; } createdLobs . clear ( ) ; lobUsageCount . clear ( ) ; return ; } }
update LobManager user counts delete lobs that have no usage