I see this code in there:
scannerId = rand.nextLong(); String scannerName = String.valueOf(scannerId); scanners.put(scannerName, s); It would be rare that rand.nextLong() would return the same id while an older scanner is still in progress, but if that happens, it seems the result would be pretty bad (i.e. the old client scanner now returning result from a different server scanner). We could just have an incrementing long (with 2^63, we'll never run our of numbers, and if we're worried about that we could reset the counter every time the scanners map is empty). I am probably not understanding this sufficiently, yet... Hence the question. Also why is scanners declared as: final Map<String, InternalScanner> scanners = new ConcurrentHashMap<String, InternalScanner>(); And not as final Map<Long, InternalScanner> scanners = new ConcurrentHashMap<Long, InternalScanner>(); All places except (ScannerListener) receive a long and calls either String.valueOf or Long.toString to convert the passed long to a String. Using Long still does autoboxing but it still seems better. Is the motivation to more descriptive names in the future? Thanks. -- Lars
