keith-turner commented on code in PR #5773:
URL: https://github.com/apache/accumulo/pull/5773#discussion_r2248381982
##########
.mvn/maven.config:
##########
@@ -1,3 +1,2 @@
-# Remove this file when the snapshot repository is no longer needed to resolve
SNAPSHOT dependencies
Review Comment:
Why was this change made?
##########
test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java:
##########
@@ -834,4 +839,31 @@ public static void
setExpectedTabletAvailability(Map<TabletId,TabletAvailability
expected.put(new TabletIdImpl(ke), availability);
}
+ @Test
+ public void testUniquenessOfTableId() throws ExecutionException,
InterruptedException {
+ Set<TableId> hash = new HashSet<>();
+
+ ExecutorService pool = Executors.newFixedThreadPool(64);
+
+ for (int i = 0; i < 1000; i++) {
+ int finalI = i;
+
+ Future<TableId> future = pool.submit(() -> {
+ TableId tableId = null;
+
+ try {
+ tableId = Utils.getNextId("yes" + finalI, getServerContext(),
TableId::of);
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ return tableId;
+ });
+
+ hash.add(future.get());
Review Comment:
This will wait for each future to complete before starting another,
preventing concurrency. Need two loops, in the first loop run through and
create all the futures and store them in a list. In the second loop, run
through the list of futures and call get() on all the futures and add the to
the hash set. That will allow them to run concurrently.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]