Hello, I think I came across a small (and mostly harmless) problem in HTablePool.getTable() code:
1 public HTableInterface getTable(String tableName) { 2 LinkedList<HTableInterface> queue = tables.get(tableName); 3 if(queue == null) { 4 queue = new LinkedList<HTableInterface>(); 5 tables.put(tableName, queue); 6 return createHTable(tableName); 7 } 8 HTableInterface table; 9 synchronized(queue) { 10 table = queue.poll(); 11 } 12 if(table == null) { 13 return createHTable(tableName); 14 } 15 return table; 16 } Considering that this method is invoked by multiple threads, it may happen that while 'queue == null' is true in line 3, it is possible to have a queue mapped to that name into the tables map when line 5 is executed. However, I don't think it will cause any harm because the overwritten queue will eventually be garbage-collected. :-) Should I write a patch for it? If so, I considered two approaches: 1. sync the *tables* attribute from lines 3 to 7. 2. or consider the interface ConcurrentMap so we could use putIfAbsent() I prefer the second. What do you think? Thanks, Guilherme