private void handlePersistence(DbClient dbClient,boolean flush){
  if (null != unManagedCGsInsert) {
    if (flush || (unManagedCGsInsert.size() > BATCH_SIZE)) {
      partitionManager.insertInBatches(unManagedCGsInsert,BATCH_SIZE,dbClient,UNMANAGED_PROTECTION_SET);
      unManagedCGsInsert.clear();
    }
  }
  if (null != unManagedCGsUpdate) {
    if (flush || (unManagedCGsUpdate.size() > BATCH_SIZE)) {
      partitionManager.updateAndReIndexInBatches(unManagedCGsUpdate,BATCH_SIZE,dbClient,UNMANAGED_PROTECTION_SET);
      unManagedCGsUpdate.clear();
    }
  }
  if (null != unManagedVolumesToUpdateByWwn) {
    if (flush || (unManagedVolumesToUpdateByWwn.size() > BATCH_SIZE)) {
      partitionManager.updateAndReIndexInBatches(new ArrayList<UnManagedVolume>(unManagedVolumesToUpdateByWwn.values()),BATCH_SIZE,dbClient,UNMANAGED_VOLUME);
      unManagedVolumesToUpdateByWwn.clear();
    }
  }
  if (null != unManagedVolumesToDelete) {
    if (flush || (unManagedVolumesToDelete.size() > BATCH_SIZE)) {
      dbClient.markForDeletion(unManagedVolumesToDelete);
      unManagedVolumesToDelete.clear();
    }
  }
}

private void handlePersistence ( DbClient dbClient , boolean flush ) { if ( null != unManagedCGsInsert ) { if ( flush || ( unManagedCGsInsert . size ( ) > BATCH_SIZE ) ) { partitionManager . insertInBatches ( unManagedCGsInsert , BATCH_SIZE , dbClient , UNMANAGED_PROTECTION_SET ) ; unManagedCGsInsert . clear ( ) ; } } if ( null != unManagedCGsUpdate ) { if ( flush || ( unManagedCGsUpdate . size ( ) > BATCH_SIZE ) ) { partitionManager . updateAndReIndexInBatches ( unManagedCGsUpdate , BATCH_SIZE , dbClient , UNMANAGED_PROTECTION_SET ) ; unManagedCGsUpdate . clear ( ) ; } } if ( null != unManagedVolumesToUpdateByWwn ) { if ( flush || ( unManagedVolumesToUpdateByWwn . size ( ) > BATCH_SIZE ) ) { partitionManager . updateAndReIndexInBatches ( new ArrayList < UnManagedVolume > ( unManagedVolumesToUpdateByWwn . values ( ) ) , BATCH_SIZE , dbClient , UNMANAGED_VOLUME ) ; unManagedVolumesToUpdateByWwn . clear ( ) ; } } if ( null != unManagedVolumesToDelete ) { if ( flush || ( unManagedVolumesToDelete . size ( ) > BATCH_SIZE ) ) { dbClient . markForDeletion ( unManagedVolumesToDelete ) ; unManagedVolumesToDelete . clear ( ) ; } } }
handle updating the database with unmanagedprotectionsets , and also clearing out any orphaned ingested unmanagedvolumes . unless the flush argument is true , only when the set to be persisted reaches the value of batch_size will the database be updated .
