meszibalu commented on a change in pull request #2685:
URL: https://github.com/apache/hbase/pull/2685#discussion_r529707941



##########
File path: 
hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestThreadLocalPoolMap.java
##########
@@ -43,42 +43,42 @@ protected PoolType getPoolType() {
   }
 
   @Test
-  public void testSingleThreadedClient() throws InterruptedException, 
ExecutionException {
+  public void testSingleThreadedClient() throws InterruptedException {
     Random rand = ThreadLocalRandom.current();
-    String randomKey = String.valueOf(rand.nextInt());
-    String randomValue = String.valueOf(rand.nextInt());
-    // As long as the pool is not full, we should get back what we put
-    runThread(randomKey, randomValue, randomValue);
-    assertEquals(1, poolMap.size(randomKey));
+    String key = "key";
+    String value = "value";
+    runThread(key, () -> value, value);
+    assertEquals(1, poolMap.values().size());
   }
 
   @Test
-  public void testMultiThreadedClients() throws InterruptedException, 
ExecutionException {
-    Random rand = ThreadLocalRandom.current();
-    // As long as the pool is not full, we should get back what we put
-    for (int i = 0; i < POOL_SIZE; i++) {
-      String randomKey = String.valueOf(rand.nextInt());
-      String randomValue = String.valueOf(rand.nextInt());
-      runThread(randomKey, randomValue, randomValue);
-      assertEquals(1, poolMap.size(randomKey));
+  public void testMultiThreadedClients() throws InterruptedException {
+    for (int i = 0; i < KEY_COUNT; i++) {
+      String key = Integer.toString(i);
+      String value = Integer.toString(2 * i);
+      runThread(key, () -> value, value);
     }
-    String randomKey = String.valueOf(rand.nextInt());
+
+    assertEquals(KEY_COUNT, poolMap.values().size());
+    poolMap.clear();

Review comment:
       I wrote a locality test.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to