public long runCycle ( ) { long recordsRemoved = countRecordsToRemove ( ) ; long recordsAddedOrModified = this . mutations . values ( ) . size ( ) - recordsRemoved ; try { long version = producer . runCycle ( populator ) ; if ( version == lastSucessfulCycle ) { return version ; } listeners . fireIncrementalCycleComplete ( version , recordsAddedOrModified , recordsRemoved , new HashMap < String , Object > ( cycleMetadata ) ) ; //Only clean changes when the version is new. clearChanges ( ) ; lastSucessfulCycle = version ; return version ; } catch ( Exception e ) { listeners . fireIncrementalCycleFail ( e , recordsAddedOrModified , recordsRemoved , new HashMap < String , Object > ( cycleMetadata ) ) ; return FAILED_VERSION ; } finally { clearCycleMetadata ( ) ; } }
Runs a Hollow Cycle if successful cleans the mutations map .