|
2 | 2 |
|
3 | 3 | import static java.lang.String.format; |
4 | 4 |
|
| 5 | +import java.util.Objects; |
5 | 6 | import java.util.concurrent.TimeUnit; |
6 | 7 | import java.util.concurrent.atomic.AtomicInteger; |
7 | 8 | import javax.annotation.Nonnull; |
@@ -303,6 +304,44 @@ public String getSyncStatisticsClassName() { |
303 | 304 | */ |
304 | 305 | protected abstract SyncStatisticsT getThis(); |
305 | 306 |
|
| 307 | + @Override |
| 308 | + public boolean equals(final Object o) { |
| 309 | + if (this == o) return true; |
| 310 | + if (o == null || getClass() != o.getClass()) return false; |
| 311 | + final BaseSyncStatistics<?> that = (BaseSyncStatistics<?>) o; |
| 312 | + return latestBatchStartTime == that.latestBatchStartTime |
| 313 | + && Objects.equals(getSyncStatisticsClassName(), that.getSyncStatisticsClassName()) |
| 314 | + && getLatestBatchProcessingTimeInDays() == that.getLatestBatchProcessingTimeInDays() |
| 315 | + && getLatestBatchProcessingTimeInHours() == that.getLatestBatchProcessingTimeInHours() |
| 316 | + && getLatestBatchProcessingTimeInMinutes() == that.getLatestBatchProcessingTimeInMinutes() |
| 317 | + && getLatestBatchProcessingTimeInSeconds() == that.getLatestBatchProcessingTimeInSeconds() |
| 318 | + && getLatestBatchProcessingTimeInMillis() == that.getLatestBatchProcessingTimeInMillis() |
| 319 | + && getUpdated().get() == that.getUpdated().get() |
| 320 | + && getCreated().get() == that.getCreated().get() |
| 321 | + && getFailed().get() == that.getFailed().get() |
| 322 | + && getProcessed().get() == that.getProcessed().get() |
| 323 | + && Objects.equals( |
| 324 | + getLatestBatchHumanReadableProcessingTime(), |
| 325 | + that.getLatestBatchHumanReadableProcessingTime()); |
| 326 | + } |
| 327 | + |
| 328 | + @Override |
| 329 | + public int hashCode() { |
| 330 | + return Objects.hash( |
| 331 | + getSyncStatisticsClassName(), |
| 332 | + getUpdated().get(), |
| 333 | + getCreated().get(), |
| 334 | + getFailed().get(), |
| 335 | + getProcessed().get(), |
| 336 | + latestBatchStartTime, |
| 337 | + getLatestBatchProcessingTimeInDays(), |
| 338 | + getLatestBatchProcessingTimeInHours(), |
| 339 | + getLatestBatchProcessingTimeInMinutes(), |
| 340 | + getLatestBatchProcessingTimeInSeconds(), |
| 341 | + getLatestBatchProcessingTimeInMillis(), |
| 342 | + getLatestBatchHumanReadableProcessingTime()); |
| 343 | + } |
| 344 | + |
306 | 345 | /** |
307 | 346 | * Builds a proper summary message of the statistics report of a given {@code resourceString} in |
308 | 347 | * following format: |
|
0 commit comments