use of de.invesdwin.util.math.decimal.scaled.Percent in project invesdwin-context-persistence by subes.
the class ADatabasePerformanceTest method printProgress.
protected void printProgress(final String action, final Instant start, final long count, final int maxCount) {
final Duration duration = start.toDuration();
log.info("%s: %s/%s (%s) %s during %s", action, count, maxCount, new Percent(count, maxCount).toString(PercentScale.PERCENT), new ProcessedEventsRateString(count, duration), duration);
}
use of de.invesdwin.util.math.decimal.scaled.Percent in project invesdwin-context-persistence by subes.
the class ADatabasePerformanceTest method printProgress.
protected void printProgress(final String action, final Instant start, final long count, final int maxCount) {
final Duration duration = start.toDuration();
log.info("%s: %s/%s (%s) %s during %s", action, count, maxCount, new Percent(count, maxCount).toString(PercentScale.PERCENT), new ProcessedEventsRateString(count, duration), duration);
}
use of de.invesdwin.util.math.decimal.scaled.Percent in project invesdwin-context-persistence by subes.
the class ASegmentedTimeSeriesStorageCache method initSegment.
private void initSegment(final SegmentedKey<K> segmentedKey, final Function<SegmentedKey<K>, ICloseableIterable<? extends V>> source) {
try {
final ITimeSeriesUpdater<SegmentedKey<K>, V> updater = newSegmentUpdater(segmentedKey, source);
final Callable<Void> task = new Callable<Void>() {
@Override
public Void call() throws Exception {
// write lock is reentrant
updater.update();
return null;
}
};
final String taskName = "Loading " + getElementsName() + " for " + hashKey;
final Callable<Percent> progress = new Callable<Percent>() {
@Override
public Percent call() throws Exception {
return updater.getProgress();
}
};
TaskInfoCallable.of(taskName, task, progress).call();
final FDate minTime = updater.getMinTime();
if (minTime != null) {
final FDate segmentFrom = segmentedKey.getSegment().getFrom();
final TimeRange prevSegment = getSegmentFinder(segmentedKey.getKey()).query().getValue(segmentFrom.addMilliseconds(-1));
if (prevSegment.getTo().equalsNotNullSafe(segmentFrom) && minTime.isBeforeOrEqualTo(segmentFrom)) {
throw new IllegalStateException(segmentedKey + ": minTime [" + minTime + "] should not be before or equal to segmentFrom [" + segmentFrom + "] when overlapping segments are used");
} else if (minTime.isBefore(segmentFrom)) {
throw new IllegalStateException(segmentedKey + ": minTime [" + minTime + "] should not be before segmentFrom [" + segmentFrom + "] when non overlapping segments are used");
}
final FDate maxTime = updater.getMaxTime();
final FDate segmentTo = segmentedKey.getSegment().getTo();
if (maxTime.isAfter(segmentTo)) {
throw new IllegalStateException(segmentedKey + ": maxTime [" + maxTime + "] should not be after segmentTo [" + segmentTo + "]");
}
}
} catch (final Throwable t) {
if (Throwables.isCausedByType(t, IncompleteUpdateFoundException.class)) {
segmentedTable.deleteRange(new SegmentedKey<K>(segmentedKey.getKey(), segmentedKey.getSegment()));
throw new RetryLaterRuntimeException(t);
} else {
throw Throwables.propagate(t);
}
}
}
use of de.invesdwin.util.math.decimal.scaled.Percent in project invesdwin-context-persistence by subes.
the class ADatabasePerformanceTest method printProgress.
protected void printProgress(final String action, final Instant start, final long count, final int maxCount) {
final Duration duration = start.toDuration();
log.info("%s: %s/%s (%s) %s during %s", action, count, maxCount, new Percent(count, maxCount).toString(PercentScale.PERCENT), new ProcessedEventsRateString(count, duration), duration);
}
use of de.invesdwin.util.math.decimal.scaled.Percent in project invesdwin-context-persistence by subes.
the class ADatabasePerformanceTest method printProgress.
protected void printProgress(final String action, final Instant start, final long count, final long maxCount) {
final Duration duration = start.toDuration();
log.info("%s: %s/%s (%s) %s during %s", action, count, maxCount, new Percent(count, maxCount).toString(PercentScale.PERCENT), new ProcessedEventsRateString(count, duration), duration);
}
Aggregations