From eaa234bfa5df4dd3d03c4fd114cc7b77646ce6b8 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Thu, 11 Oct 2018 19:25:01 +0200 Subject: [PATCH] rename put to putEntries The method name put is used too often so that eclipse has a hard time finding references. --- .../java/org/lucares/pdbui/TcpIngestor.java | 2 +- .../lucares/performance/db/PerformanceDb.java | 14 ++++++------ .../performance/db/PerformanceDbTest.java | 22 +++++++++---------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/pdb-ui/src/main/java/org/lucares/pdbui/TcpIngestor.java b/pdb-ui/src/main/java/org/lucares/pdbui/TcpIngestor.java index 4c44c53..2b67da1 100644 --- a/pdb-ui/src/main/java/org/lucares/pdbui/TcpIngestor.java +++ b/pdb-ui/src/main/java/org/lucares/pdbui/TcpIngestor.java @@ -189,7 +189,7 @@ public class TcpIngestor implements Ingestor, AutoCloseable, DisposableBean { boolean finished = false; while (!finished) { try { - db.put(new BlockingQueueIterator<>(queue, Entry.POISON)); + db.putEntries(new BlockingQueueIterator<>(queue, Entry.POISON)); finished = true; } catch (final Exception e) { LOGGER.warn("Write to database failed. Will retry with the next element.", e); diff --git a/performanceDb/src/main/java/org/lucares/performance/db/PerformanceDb.java b/performanceDb/src/main/java/org/lucares/performance/db/PerformanceDb.java index 4c57eae..0ac3bd0 100644 --- a/performanceDb/src/main/java/org/lucares/performance/db/PerformanceDb.java +++ b/performanceDb/src/main/java/org/lucares/performance/db/PerformanceDb.java @@ -37,21 +37,21 @@ public class PerformanceDb implements AutoCloseable { tagsToFile = new TagsToFile(dataStore); } - public void put(final Entry entry) throws WriteException { - put(Arrays.asList(entry)); + public void putEntry(final Entry entry) throws WriteException { + putEntries(Arrays.asList(entry)); } - public void put(final Iterable entries) throws WriteException { - put(entries.iterator()); + public void putEntries(final Iterable entries) throws WriteException { + putEntries(entries.iterator()); } - public void put(final Iterator entries) throws WriteException { + public void putEntries(final Iterator entries) throws WriteException { final BlockingIteratorIterator iterator = new BlockingIteratorIterator<>(entries); - put(iterator); + putEntries(iterator); } - public void put(final BlockingIterator entries) throws WriteException { + public void putEntries(final BlockingIterator entries) throws WriteException { final Duration timeBetweenSyncs = Duration.ofSeconds(10); long count = 0; diff --git a/performanceDb/src/test/java/org/lucares/performance/db/PerformanceDbTest.java b/performanceDb/src/test/java/org/lucares/performance/db/PerformanceDbTest.java index 6ed8793..ec5fce0 100644 --- a/performanceDb/src/test/java/org/lucares/performance/db/PerformanceDbTest.java +++ b/performanceDb/src/test/java/org/lucares/performance/db/PerformanceDbTest.java @@ -44,7 +44,7 @@ public class PerformanceDbTest { final OffsetDateTime date = DateUtils.nowInUtc(); final long value = 1; final Tags tags = Tags.create("myKey", "myValue"); - db.put(new Entry(date, value, tags)); + db.putEntry(new Entry(date, value, tags)); final Result result = db.get(Query.createQuery(tags)); final LongList stream = result.singleGroup().flatMap(); @@ -65,8 +65,8 @@ public class PerformanceDbTest { final long valueTwo = 2; final Tags tags = Tags.create("myKey", "myValue"); - db.put(new Entry(dayOne, valueOne, tags)); - db.put(new Entry(dayTwo, valueTwo, tags)); + db.putEntry(new Entry(dayOne, valueOne, tags)); + db.putEntry(new Entry(dayTwo, valueTwo, tags)); final LongList stream = db.get(Query.createQuery(tags)).singleGroup().flatMap(); @@ -120,9 +120,7 @@ public class PerformanceDbTest { printEntries(entries, ""); - for (final Entry entry : entries) { - db.put(entry); - } + db.putEntries(entries); final LongList actualEntries = db.get(Query.createQuery(tags)).singleGroup().flatMap(); Assert.assertEquals(actualEntries.size(), entries.size() * 2); @@ -162,7 +160,7 @@ public class PerformanceDbTest { final TimeRange timeRange = TimeRange.ofDay(DateUtils.getDate(year, month, day, 1, 1, 1)); final List entries = generateEntries(timeRange, numberOfEntries, 0, tags); - db.put(entries); + db.putEntries(entries); expected.addAll(entries); } @@ -174,7 +172,7 @@ public class PerformanceDbTest { final TimeRange timeRange = TimeRange.ofDay(DateUtils.getDate(year, month, day, 1, 1, 1)); final List entries = generateEntries(timeRange, numberOfEntries, 0, tags); - db.put(entries); + db.putEntries(entries); expected.addAll(entries); final LongList actualEntries = db.get(Query.createQuery(tags)).singleGroup().flatMap(); @@ -196,18 +194,18 @@ public class PerformanceDbTest { final Tags tagsCommon = Tags.create("commonKey", "commonValue"); final Tags tagsOne = Tags.create("myKey", "one", "commonKey", "commonValue"); final List entriesOne = generateEntries(timeRange, numberOfEntries, 1, tagsOne); - db.put(entriesOne); + db.putEntries(entriesOne); printEntries(entriesOne, "one"); final Tags tagsTwo = Tags.create("myKey", "two", "commonKey", "commonValue"); final List entriesTwo = generateEntries(timeRange, numberOfEntries, 2, tagsTwo); printEntries(entriesTwo, "two"); - db.put(entriesTwo); + db.putEntries(entriesTwo); final Tags tagsThree = Tags.create("myKey", "three", "commonKey", "commonValue"); final List entriesThree = generateEntries(timeRange, numberOfEntries, 3, tagsThree); printEntries(entriesThree, "three"); - db.put(entriesThree); + db.putEntries(entriesThree); final LongList actualEntriesOne = db.get(Query.createQuery(tagsOne)).singleGroup().flatMap(); Assert.assertEquals(actualEntriesOne, toExpectedValues(entriesOne)); @@ -319,7 +317,7 @@ public class PerformanceDbTest { private LongList storeEntries(final PerformanceDb performanceDb, final TimeRange timeRange, final long numberOfEntries, final Tags tags, final int addToDate) { final List entries = generateEntries(timeRange, numberOfEntries, addToDate, tags); - performanceDb.put(entries); + performanceDb.putEntries(entries); final LongList result = new LongList();