public synchronized void realignAllBeatsForTenant()

in service/src/main/java/org/apache/fineract/cn/rhythm/service/internal/service/Drummer.java [112:131]


  public synchronized void realignAllBeatsForTenant(
      final String tenantIdentifier,
      final ClockOffsetEntity oldClockOffset,
      final ClockOffsetEntity newClockOffset)
  {
    final Stream<BeatEntity> beatsToAdjust = beatRepository.findByTenantIdentifier(tenantIdentifier);
    beatsToAdjust.forEach(x -> {
      //Need to subtract old clock offset, because for large clock offsets and large alignments,
      //time can "skip" into the next day through realignment.
      final LocalDateTime oldBeatNextBeat = x.getNextBeat()
          .minusHours(oldClockOffset.getHours())
          .minusMinutes(oldClockOffset.getMinutes())
          .minusSeconds(oldClockOffset.getSeconds());
      x.setNextBeat(BeatMapper.alignDateTime(
          oldBeatNextBeat,
          x.getAlignmentHour(),
          newClockOffset));
      beatRepository.save(x);
    });
  }