コード例 #1
0
  private GenericRecord createAddress(int memberId) {
    GenericRecord record = new GenericData.Record(_store.getSchema());

    record.put("id", memberId);
    record.put("city", new Utf8("city." + memberId));
    record.put("state", new Utf8("state." + memberId));
    record.put("country", new Utf8("country." + memberId));
    record.put("postal_code", new Utf8("postal." + memberId));

    return record;
  }
コード例 #2
0
  @Override
  public void run() {
    int capacity = _store.capacity();
    int memberId = _rand.nextInt(capacity);

    try {
      String key = "member." + memberId;
      GenericRecord value = createAddress(memberId);
      _writer.put(key, value, System.currentTimeMillis());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }