use of de.invesdwin.util.math.decimal.TimedDecimal in project invesdwin-context-persistence by subes.
the class TimedDecimalSerde method fromBytes.
@Override
public TimedDecimal fromBytes(final byte[] bytes) {
final ByteBuffer buffer = ByteBuffer.wrap(bytes);
final FDate time = FDates.extractFDate(buffer);
final Decimal percent = Decimal.extractDecimal(buffer);
final TimedDecimal timedMoney = new TimedDecimal(time, percent);
return timedMoney;
}
use of de.invesdwin.util.math.decimal.TimedDecimal in project invesdwin-context-persistence by subes.
the class BasicRecordFilePerformanceTest method testBasicRecordFilePerformance.
@Test
public void testBasicRecordFilePerformance() throws IOException, InterruptedException {
final File directory = new File(ContextProperties.getCacheDirectory(), BasicRecordFilePerformanceTest.class.getSimpleName());
Files.deleteNative(directory);
Files.forceMkdir(directory);
final File file = new File(directory, "testBasicRecordFilePerformance");
final LoopInterruptedCheck loopCheck = new LoopInterruptedCheck(Duration.ONE_SECOND);
final Instant writesStart = new Instant();
try (BasicRecordFile.Writer<TimedDecimal> writer = new BasicRecordFile.Writer<>(file, IndeedSerializer.valueOf(TimedDecimalSerde.GET))) {
int i = 0;
for (final FDate date : newValues()) {
writer.append(new TimedDecimal(date, date.millisValue()));
i++;
if (i % FLUSH_INTERVAL == 0) {
if (loopCheck.check()) {
printProgress("Writes", writesStart, i, VALUES);
}
}
}
printProgress("WritesFinished", writesStart, VALUES, VALUES);
}
readIterator(file);
}
Aggregations