예제 #1
0
  private void populate(HashFunction<byte[]> hashFunc, HashMap<Long, Integer> hashCodes)
      throws IOException {
    int lineCnt = _lineSeedData.size();
    long startTime = System.currentTimeMillis();

    try {
      for (int i = 0; i < _keyCount; i++) {
        String s = _lineSeedData.get(i % lineCnt);
        String k = s.substring(0, 30) + i;
        long hash = hashFunc.hash(k.getBytes());
        Integer cnt = hashCodes.get(hash);
        cnt = (cnt == null) ? 0 : cnt;
        hashCodes.put(hash, cnt + 1);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    long endTime = System.currentTimeMillis();
    long elapsedTime = endTime - startTime;
    StatsLog.logger.info("elapsedTime=" + elapsedTime + " ms");
  }
예제 #2
0
 protected long hash(byte[] key) {
   return _hashFunction.hash(key);
 }